You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [10]: Permission.objects.filter(content_type__model__icontains='cow')[2].codename
Out[10]: 'change_cow'
In [11]: Permission.objects.filter(content_type__model__icontains='cow')[2].content_type
Out[11]: <ContentType: test_app | cow2>
The old permissions reference the new model but keep the old entries.
Given that this is unsolved in the standard permission model, I think it is a bad idea to embark on on fix in this project (you should fix it in Django itself first). So this should be handled by documenting the behavior and what is needed to work around.
The text was updated successfully, but these errors were encountered:
AlanCoding
changed the title
Document for implication of renaming a model for resource registry / RBAC
Documentation for implication of renaming a model for resource registry / RBAC
Mar 19, 2024
Consider renaming a model,
Cow
in test_app toCow2
. After doing that experimentally locally and migrating:After migration, you will find that
ContentType
handles this gracefully. The Django Permission class does not:The old permissions reference the new model but keep the old entries.
Given that this is unsolved in the standard permission model, I think it is a bad idea to embark on on fix in this project (you should fix it in Django itself first). So this should be handled by documenting the behavior and what is needed to work around.
The text was updated successfully, but these errors were encountered: