Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User permissions on proxy models in modeladmin

When using a proxy model:

class Uf(models.Model):
...

class CustomUf(Uf):
    class Meta:
        proxy = True

class CustomUfAdmin(admin.ModelAdmin)

admin.site.register(CustomUf, CustomUfAdmin)

It seems like only superusers can access the CustomUf through admin site... I can't figure out how to grant permissions on CustomUf to regular users...

like image 752
Lapin-Blanc Avatar asked Nov 11 '11 16:11

Lapin-Blanc


2 Answers

Ok, Chris remark about content types gave me the hint...

I made the mistake to define the proxy object in "admin.py". This way, you have to be superadmin to access it.

If I define the proxy object in models.py, then the content type appears and everything works fine...

like image 140
Lapin-Blanc Avatar answered Nov 02 '22 18:11

Lapin-Blanc


You need to run syncdb again so the new content types can be picked up.

like image 33
Chris Pratt Avatar answered Nov 02 '22 18:11

Chris Pratt