开发者

how to solve this problem ? "You don't have permission to edit anything. " in django

i created a superuser account , but when I log in with it , i can't edit any of the installed applications !

how can I grant permissions for this us开发者_运维知识库er to allow editing applications ??


Try adding the line admin.autodiscover() to your main urls.py, making sure to do from django.contrib import admin first.

see this answer


Found this info useful in this context.

So simply replace django.contrib.admin with django.contrib.admin.apps.SimpleAdminConfig in installed apps.

from adminplus.sites import AdminSitePlus

#Add this line.  
admin.site = AdminSitePlus()
admin.autodiscover()  # automatic autodiscover should be turned off in settings


Have you created admin.py files for all your apps, registered the models, and called admin.site.register() in urls.py?


I had this problem happen upgrading from Django 1.6 -> 1.8. The solution for me turned out to be simply removing admin.site = AdminSitePlus() from the top of my urls.py. So, this:

admin.site = AdminSitePlus()
admin.autodiscover()

became this:

admin.autodiscover()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜