Django admin not showing models

后端 未结 6 1651
悲&欢浪女
悲&欢浪女 2021-02-07 09:27

I\'m damned if I can figure out why my models are not showing in the admin.

models.py looks like this:

from django.db import models

class Publication(mo         


        
6条回答
  •  攒了一身酷
    2021-02-07 09:47

    Double check your permissions - that is: if you think your user is a superuser, just go look to make sure! If your user is not a superuser, look in your "Authentication and Authorization" › "Users" under the user you are logged in as and see if the "User permissions:" include the models for the application in question.

    After chasing this for longer than I care to admit, I realized my user was not actually a superuser. As you will see on many of the related posts, it is easy for an application to not show in Admin if the user does not have the correct permissions, such as here:

    As you can see from this, user 2 does not have the required permissions on the "done" app's models - only on the "timekeeping" app's models.

    I was fairly certain this was a superuser (but it's not). I figure either I must have reduced my permissions to troubleshoot an issue another user had been seeing or to give a more representative experience using the system.

    PS A giveaway for this being the issue is that any clean database where you use the python manage.py createsuperuser to get going will show all of your registered apps/models whereas an existing database (where permissions may be more nuanced) will show only some of your registered apps/models.

提交回复
热议问题