简体   繁体   中英

Django admin panel lags and doesn't show anything

Today I've launched my Django project and saw a really weird behavior of Django admin panel. At the first sight, everything looks OK but as soon as I click on any model to view, I can't see anything. The most strange thing is that I've got no weird commits that could damage the contents of admin panel recently. The only commit could do that is updating Django to 3.1 version. I've already tried reinstalling Django and installing older versions but nothing works.

Here is the typical admin panel homepage

Here is what happens when I click on models

I really need to know how to fix it as well as both me and my friend have this issue and we can't deal with it.

First thing that you should check for this error is to see if you are calling:

admin.site.register(<model-name>)

and not

admin.register(<model-name>)

if this is not the case then try running the migrations again

python manage.py makemigrations 
python manage.py migrate 

Finally, make sure your admin.py file with the code is actually inside the directory of the app (ie the same directory with your models.py that defines MyModel).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM