question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Import of django.contrib.admin.models.LogEntry in reversion.models causes startup error

See original GitHub issue

The top level import of django.contrib.admin.models.LogEntry in the module reversion.models causes a startup error in Django projects that don’t include django.contrib.admin in INSTALLED_APPS:

RuntimeError: Model class django.contrib.admin.models.LogEntry doesn’t declare an explicit app_label and isn’t in an application in INSTALLED_APPS.

Perhaps this import could moved into the Revision.get_comment() method?

Affects version 3.0.0

https://github.com/etianen/django-reversion/blob/d4cb8aa5ca383b3d9bf57b07598d0e86dc390c2e/reversion/models.py#L10

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
wyleecommented, Aug 9, 2018

That’s a possible solution, as I noted above, but not all projects use the Django admin and IMO shouldn’t be required to “install” it just to avoid this error.

0reactions
c0dearmcommented, Apr 2, 2019

Now that the PR has been merged I think this issue can be closed 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tying in to Django Admin's Model History - Stack Overflow
The model is in django.contrib.admin.models.LogEntry. When a user makes a change, add to the log like this (stolen shamelessly from ...
Read more >
Common problems — django-reversion 5.0.4 documentation
This is caused by your models.py file being imported twice, resulting in reversion.register() being called twice for the same model. This problem is...
Read more >
The Django admin site
This function attempts to import an admin module in each installed application. Such modules are expected to register models with the admin. Typically...
Read more >
django-reversion Documentation - Read the Docs
To enable this, simply register your models with a subclass of reversion.VersionAdmin. import reversion class YourModelAdmin(reversion.
Read more >
django Changelog - pyup.io
Fixed a bug in Django 4.1 that caused a crash of model validation on ... The admin :meth:`history view <django.contrib.admin.ModelAdmin.history_view>`
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found