Thursday, April 2, 2020

Using a custom AdminSite subclass

Hello everybody,

I'm using a custom AdminSite subclass. But since the update from Django 2.0.13 to 2.2.12 I'm having problems to get it recognized when creating or running migrations.

This is what I have in hal/admin.py:

from django.contrib import admin

class HalAdminSite(admin.AdminSite):
   
# ...

admin_site
= HalAdminSite()
admin_site
.register(Profile)
# ...

This is what I have in hal/apps.py:

from django.contrib.admin.apps import AdminConfig

class HalAdminConfig(AdminConfig):
    default_site
= 'hal.admin.HalAdminSite'

This is what I have in settings.py:

INSTALLED_APPS = [
   
# ....
   
'hal.apps.HalAdminConfig',
   
# ...
]

Nevertheless I get the following exceptions when running makemigrations or migrate:    AttributeError: module 'hal.admin' has no attribute 'HalAdminSite'  ImportError: Module "hal.admin" does not define a "HalAdminSite" attribute/class

Any hints about how I can fix this? That would be really appreciated!.


Greetings
Oliver

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3771ea7d-1144-48ee-9060-933fd6837e5a%40googlegroups.com.

No comments:

Post a Comment