'Django superuser doesn't have permission to delete models
I am working on upgrading a Django website from Django 1.8 to Django 2.2 and have come across a problem when trying to delete an object from the Django admin changelist view. When I try to delete an object, I am shown a screen with the words "Deleting the selected Records would result in deleting related objects, but your account doesn't have permission to delete the following types of objects". The problem is, I am a superuser and should have permission to delete any object I want, or so I thought.
I have read a decent amount of documentation on Django upgrades and permissions of superusers, however I haven't stumbled across anything that helps me (I could be missing something though). I have tried creating a new superuser just in case, still the same message occurs though. Anyway, Does anyone have any idea why this could be happening?
Note: I can't show any code because I am working for a company and I signed an NDA. Just some help pointing me in the right direction would be appreciated.
Solution 1:[1]
For anyone else who stumbles across this problem, dirkgroten was right and it turns out the has_delete_permission was overridden! Thanks for your help dirkgroten!
Solution 2:[2]
OPENEDX If You are facing This issue then do this thing from the backend.
Cannot delete user Deleting the selected user would result in deleting related objects, but your account doesn't have permission to delete the following types of objects: course enrollment
Open Mysql In EDX server like AWS then get user id based on username then student_courseenrollment delete from this user
Example
select id from auth_user where username = 'exampleusername'
delete from student_courseenrollment where user_id = get user_id from 1 query set;
like delete from student_courseenrollment where user_id = 123;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | I_am_learning_now |
Solution 2 | Neeraj Kumar |