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

Unable to unregister ModelAdmin #15

Closed
PetrDlouhy opened this issue Dec 7, 2022 · 1 comment
Closed

Unable to unregister ModelAdmin #15

PetrDlouhy opened this issue Dec 7, 2022 · 1 comment

Comments

@PetrDlouhy
Copy link
Owner

If I try to unregister ModelAdmin with RelatedFieldAdmin ancestor I got error:

  File "/home/petr/soubory/programovani/blenderkit/blenderhub_server/blenderhub/apps/history_register/admin.py", line 7, in <module>
    admin.site.unregister(PaymentAdmin)
  File "/home/petr/.cache/pypoetry/virtualenvs/blenderkit-server-eqrfB9dY-py3.10/lib/python3.10/site-packages/django/contrib/admin/sites.py", line 159, in unregister
    for model in model_or_iterable:
TypeError: 'RelatedFieldAdminMetaclass' object is not iterable
@PetrDlouhy
Copy link
Owner Author

The problem was, that I was unregistering ModelAdmin, not Model. It should be:

admin.site.unregister(Payment)

not

admin.site.unregister(PaymentAdmin)

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

No branches or pull requests

1 participant