views:

83

answers:

3

Hi folks,

is it possible to give users the permission to view, but not to change or delete.

currently in the only permissions I see are "add", "change" and "delete"... but there is no "read/view" in there.

I really need this as some users will only be able to consult the admin panel, in order to see what has been added in.


Help would be amazing!

+2  A: 

You can't just view things in django admin.

There is a databrowse app for that.

valya
A: 

One workaround would be to have an additional "save" permission on your model and check in the modeladmin's save_model method if the user has this permissions, if he has not, that would mean he can do everything in this modeladmin, except saving edited data!

lazerscience
@lazerscience: that is an awesome idea!! Thanks! I think I might tick this answer as accepted :)
RadiantHex
A: 

You can do this by following way:

1)You can make the fields read only if the object has been created.But doing this noone will be able to change the fields

2)You can use databrowse

3)You can use form validation ,if user is not in the selected list throw validation error if any field is changed

4)you can create a view ,if user is in your list then redirect it to normal flow or else redirect him to simple html readonly page

5)Use jquery to make the fields readonly is user is not in the list and override the save method to check any smartness.In your save method you throw error any form has changed and user is not in your list.username=request.user.username

ha22109