Has anybody ever implemented an extension to class ModelAdmin to add "view_form" function and templates?
I'm in a situation where the logged user can list both draft and published files. With ModelAdmin.queryset i filter the files the user is allowed to list in "change_list" view, but those files include also the published one that should only be viewed, not edited, by an editor user. I tried to use the .has_change_permission, but this is a shortcut to a Permission Denied exception, rather that a .view_"form" page. So I was planning to add this feature. I had two ways in my mind: - the cleaner one: modify / override some methods of the ModelAdmin class so that if the current user do not has_change_permission for a model instance and clicks the widget to edit the instance, he is presented with a simple view page, that has the same look of the other admin pages and simply shows all the fields of the instance (it could look for a class attribute "display_empty" to decide whether to output empty fields or not) - the dirty way: (which I think could be easier for a Django newbie like me) in urlconf "trap" the edit url with the admin prefix for each model. The view checks if the user is allowed to edit the instance (and thus the default admin view for change_form should be returned) or not, and in the latter case the user is presented with a view_form. Due to my newbieness I am thinking about going the dirty way, but I do not know how the change_form view is called and how url regexp splitting is performed (is it with ?P<id> or just parenthesis?). Please, can anybody give me any hints?--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.