Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Group has not been registered with django-reversion #214

Closed
nemesifier opened this issue Jan 7, 2021 · 2 comments · Fixed by #215
Closed

[bug] Group has not been registered with django-reversion #214

nemesifier opened this issue Jan 7, 2021 · 2 comments · Fixed by #215
Assignees
Labels

Comments

@nemesifier
Copy link
Member

This shows up in instances installed via ansible-openwisp2 but can be replicated in the dev env.

How to replicate:

  • add reversion to INSTALLED_APPS, install django-reversion if you don't have it installed in your virtualenv already, in openwisp-users is optional
  • go to groups, open a group, (eg: administrator), make some changes, save, repeat the process again
  • click on the "history" button in the upper right part of the page
  • different revisions will appear, click on any

Expected outcome:

Page with the revision appears.

Actual outcome:

<class 'django.contrib.auth.models.Group'> has not been registered with django-reversion
@nemesifier nemesifier added the bug label Jan 7, 2021
@nemesifier
Copy link
Member Author

Fun fact, trying to register Group manually yields the opposite exception:

>>> from reversion import revisions
>>> revisions.register(Group)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    revisions.register(Group)
  File "/opt/openwisp2/env/lib/python3.8/site-packages/reversion/revisions.py", line 406, in register
    return register(model)
  File "/opt/openwisp2/env/lib/python3.8/site-packages/reversion/revisions.py", line 373, in register
    raise RegistrationError("{model} has already been registered with django-reversion".format(
reversion.errors.RegistrationError: <class 'openwisp_users.models.Group'> has already been registered with django-reversion

@nemesifier
Copy link
Member Author

Oh I see now, Group is being interpreted in two different ways:

  • openwisp_users.models.Group: registered
  • django.contrib.auth.models.Group: not registered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants