views:

35

answers:

2

Hi All,

Is there a way to implement the permissions for models through the code? I have a large set of models and I want some of the models to be just viewable by the admin and not the ability to add them.

Please suggest.

A: 

You can set permissions through the admin site itself. For instructions, see the "Users, Groups and Permissions" section in the django book chapter:

ars
Thanks for your reply. I know I can set the permissions from the admin interface, but those permissions can be changed by the admin. I want to restrict the admin itself.
anand
Oh. Not sure if there's an easy way to do that, but why not create other users, give them restricted access (i.e. with appropriate permissions) to the admin interface? The admin is a superuser for a reason, and there's no need to hand out that account to anyone who doesn't have rights.
ars
A: 

Found the solution here: http://code.djangoproject.com/wiki/RowLevelPermissions

works the way I needed.

anand