Custom permissions on proxy model no longer created in 1.4

194 views
Skip to first unread message

koenb

unread,
Mar 15, 2012, 5:27:33 AM3/15/12
to django-d...@googlegroups.com
Hi all,

this could very well be one of those "don't do that" things, but here is my problem.

I have been using some specific permissions concerning the auth user model, so I created a proxy model on user like this:

class User(auth_models.User):
    class Meta:
        proxy = True
        permissions = (
            ("display_users", "May display users information"),
            ("edit_users", "May edit users information"),
        )

In 1.3 these custom permissions were created during syncdb (linked to the auth.User model).

Now I was testing my project with the 1.4 RC, and it turns out those permissions are no longer created.

This is caused by the refactor of the create_permissions code, which now uses get_for_models to determine the class to get the options for, but this returns the proxied class (auth.User), not the proxy class, so my custom permissions are not found and not created.

Maybe I am using the proxy model for something it was not intended for. If so, it might be a good idea to add a warning in the release notes about this, in case others are doing something similar.

BTW, thanks for yet another awesome new release.

Koen

Aymeric Augustin

unread,
Mar 15, 2012, 6:52:42 AM3/15/12
to django-d...@googlegroups.com
Le 15 mars 2012 10:27, koenb <koen.b...@werk.belgie.be> a écrit :
this could very well be one of those "don't do that" things, but here is my problem.

I have been using some specific permissions concerning the auth user model
(... snip ...) 
Now I was testing my project with the 1.4 RC, and it turns out those permissions are no longer created.

Hi Koen,

At first sight, you code is valid, and this is a regression.

I suppose it happened somewhere in this list:

Could you open a ticket on code.djangoproject.com and set Severity to "Release blocker"?

Thanks,
 
--
Aymeric.

koenb

unread,
Mar 15, 2012, 7:13:42 AM3/15/12
to django-d...@googlegroups.com
Op donderdag 15 maart 2012 11:52:42 UTC+1 schreef Aymeric Augustin het volgende:

Done: #17904

Koen
 
Reply all
Reply to author
Forward
0 new messages