-
- Downloads
Incase migrations create the same permission twice
When upgrading from Django 2.0 to 3.2, Django decided to create the one or other permission with the exact same name but with a different content_type! That's why we needed to ensure 'our' content_type is the one we want to get and not the duplicate from django!
-
mentioned in commit 23e86d6f
-
Umm... Sorry I had to revert it.
This is whole the point of
.get
bycodename
withoutcontent_type
, such that this function can use permissions created by django ordjango.contrib
which mostly havecontent_type
different from the user model.What was the particular project / situation when it refused to work? I am almost sure it had something to do with models being moved from one project to another, and old permissions never cleaned up...
-
So basically it uses the user model content type as fallback, when it needs a permission, but has no good model to attach it to. (I will add more comments into the code. I will also try to workaround the situation you experienced.)
Edited by Art -
-
It was research (of course it was). It uses a custom
'view_project'
permission and by upgrading Django it also introduced a'view_project'
permission generated by Django because there are view permissions now and research happens to have aProject
model.But yeah, indeed makes sense to not include the
content_type
in the lookup.