Есть models.py
from django.db import models
from auditlog.registry import auditlog
from auditlog.models import AuditlogHistoryField
class NoteClass(models.Model):
notebook = models.CharField(max_length=20)
def __str__(self):
return self.notebook
class MyModel(models.Model):
sku = models.CharField(max_length=20)
version = models.CharField(max_length=5)
product = models.CharField(max_length=50, verbose_name='Product Name')
history = AuditlogHistoryField()
last_updated = models.DateTimeField(auto_now_add=True)
address = models.CharField(max_length=90)
contacts = models.ManyToManyField(NoteClass)
auditlog.register(MyModel)
auditlog.register(MyModel, exclude_fields=['last_updated'])
auditlog.register(MyModel, mapping_fields={'sku': 'Product No.', 'version': 'Product Revision'})
auditlog.register(MyModel, mask_fields=['address'])
auditlog.register(MyModel, m2m_fields={'contacts'})
# auditlog.register(MyModel, serialize_data=False)
auditlog.register(
MyModel,
exclude_fields=["last_updated"],
# serialize_data=False,
# serialize_auditlog_fields_only=True,
)
Когда в админ-панели кликаю на модель MyModel получаю ошибку:
TypeError at /admin/library/mymodel/
__call__() missing 1 required keyword-only argument: 'manager'
Traceback Switch to copy-and-paste view
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/contrib/admin/utils.py, line 271, in lookup_field
f = _get_non_gfk_field(opts, name) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/contrib/admin/utils.py, line 309, in _get_non_gfk_field
raise FieldDoesNotExist() …
Local vars
During handling of the above exception (), another exception occurred:
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/core/handlers/exception.py, line 55, in inner
response = get_response(request) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/core/handlers/base.py, line 220, in _get_response
response = response.render() …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/response.py, line 114, in render
self.content = self.rendered_content …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/response.py, line 92, in rendered_content
return template.render(context, self._request) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/backends/django.py, line 62, in render
return self.template.render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 175, in render
return self._render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 167, in _render
return self.nodelist.render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 1005, in render
return SafeString("".join([node.render_annotated(context) for node in self])) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 1005, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in self])) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 966, in render_annotated
return self.render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/loader_tags.py, line 157, in render
return compiled_parent._render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 167, in _render
return self.nodelist.render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 1005, in render
return SafeString("".join([node.render_annotated(context) for node in self])) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 1005, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in self])) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 966, in render_annotated
return self.render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/loader_tags.py, line 157, in render
return compiled_parent._render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 167, in _render
return self.nodelist.render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 1005, in render
return SafeString("".join([node.render_annotated(context) for node in self])) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 1005, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in self])) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 966, in render_annotated
return self.render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/loader_tags.py, line 63, in render
result = block.nodelist.render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 1005, in render
return SafeString("".join([node.render_annotated(context) for node in self])) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 1005, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in self])) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 966, in render_annotated
return self.render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/loader_tags.py, line 63, in render
result = block.nodelist.render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 1005, in render
return SafeString("".join([node.render_annotated(context) for node in self])) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 1005, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in self])) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/base.py, line 966, in render_annotated
return self.render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/contrib/admin/templatetags/base.py, line 45, in render
return super().render(context) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/template/library.py, line 258, in render
_dict = self.func(*resolved_args, **resolved_kwargs) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/contrib/admin/templatetags/admin_list.py, line 336, in result_list
"results": list(results(cl)), …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/contrib/admin/templatetags/admin_list.py, line 312, in results
yield ResultList(None, items_for_result(cl, res, None)) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/contrib/admin/templatetags/admin_list.py, line 303, in __init__
super().__init__(*items) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/contrib/admin/templatetags/admin_list.py, line 213, in items_for_result
f, attr, value = lookup_field(field_name, result, cl.model_admin) …
Local vars
/home/ioann/.local/share/virtualenvs/Django_Libraries-js9DAKL4/lib/python3.8/site-packages/django/contrib/admin/utils.py, line 284, in lookup_field
value = attr() …
Local vars