[Django]-How to unregister table from django admin whose created when package are installed

5👍

You can unregister default models in admin.py of your app by using unregister.

from django.contrib import admin
from django_summernote.models import Attachment

admin.site.unregister(Attachment)
👤mrzrm

4👍

In your settings.py, change the INSTALLED_APPS structure something as below,

INSTALLED_APPS = [
    'django_summernote',  # this is the third-party app
    'my_django_app',  # this is your app
    ...
]

Then, in the admin.py of my_django_app

from django_summernote.models import Attachment
admin.site.unregister(Attachment)

The order of INSTALLED_APPS structure is important here. Because, Django loads each apps according to the order in which we put those in the INSTALLED_APPS.

👤JPG

Leave a comment