Django. You don't have permission to edit anything

PythonDjangoDjango Admin

Python Problem Overview


I created a little app a while ago. I created admin.py and used admin.site.register(MenuEntry) to add the class to admin console. It showed the items of that class just fine. Then I began working on another app and created everything as before. But now it says: You don't have permission to edit anything. I compared files from that and from this apps and they look quite similar, so I just can't find the difference and I can't realize what to do now to make it work.

Python Solutions


Solution 1 - Python

I checked files one more time and found the difference. I forgot to add admin.autodiscover() in urls.py of the project. Thanks.

Solution 2 - Python

I had another case where this happened. I had an app called "transcription", with two models: Project and Recording. After getting it mostly developed I decided to rename the app "recordings". The admin app worked fine as the admin but any non-admin user got this error message. Eventually I found (in my sqlite db) the table django_content_type. It had these records:

id  name      app_label     model

8 project transcription project 9 recording transcription recording 10 project recording project 11 recording recordings recording

Somewhere along the way I had managed to add two (almost - don't know why "recording" in record 10) correct records while leaving the now incorrect records intact. The admin user worked just fine (I wonder why), but any other group got the error. When I looked at auth_group_permissions I saw that only records 8 and 9 were being assigned and of course there was no longer an app called "transcription". Hence the error.

I deleted records 10 and 11 and changed the app_labels of 8 and 9 to "recordings" and there's joy in Mudville.

Solution 3 - Python

Upgrade your Django to 1.7 or more, This problem will be automatically solved.

Upgrading Django:

pip install -U django

Solution 4 - Python

I was receiving the same error and had to refactor the appname as it conflicted with one of the modules being used. My app's name was admin and I was also using Django's admin.

Check the link - Change app's name, on how to do it.

Solution 5 - Python

I just simply Removed all currently installed versions of Django. Then freshly install the latest version of Django and it works

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSergei BasharovView Question on Stackoverflow
Solution 1 - PythonSergei BasharovView Answer on Stackoverflow
Solution 2 - PythonJoe GillonView Answer on Stackoverflow
Solution 3 - PythonNareshView Answer on Stackoverflow
Solution 4 - PythonVaulsteinView Answer on Stackoverflow
Solution 5 - PythonSachin PatelView Answer on Stackoverflow