Login

Tag "customization"

Snippet List

Add a button to the top of the admin change form

I found [snippet #1016](http://www.djangosnippets.org/snippets/1016/) while looking for a way to add a button to the top of an admin change form, and it didn't work. I found that it used the old admin, so I updated it to django 1.1.1

  • admin
  • customization
Read More

More information about users and groups in user admin

Based on [this snippet](http://www.djangosnippets.org/snippets/876/). More clean, with links to the related admin forms. Nice example on customization of contributed django admin apps. It adds the following to the user list interface: fields for is_superuser and is_staff, last login time; by default, short names of groups user is in (mousehover to see full names) It adds the following to the to group list interface: list of users in your groups. To enable, just put it somewhere and import it from your main urls.py: import utils/admin_auth.py

  • admin
  • customization
  • users
  • groups
  • roles
Read More

More information about users and groups in user admin

Add-on for auth app of newforms-admin branch, adding more information about users and their groups at user and group list in admin interface. Also, nice example on customization of contributed django admin apps. It adds the following to the user list interface: fields for is_superuser and is_staff, last login time; by default, short names of groups user is in (mousehover to see full names) It adds the following to the to group list interface: list of users in your groups. To enable, just put it somewhere and import it from your main urls.py: import useradmin

  • admin
  • newforms-admin
  • customization
  • users
  • groups
  • roles
  • information
  • nfa
  • supervising
Read More

FieldLevelPermissionsAdmin

Have you ever needed to customize permissions, for example, allow only some fields for editing by some group of users, display some fields as read-only, and some to hide completely? FieldLevelPermissionsAdmin class does this for newforms-admin branch. Not tested well yet (>100 LOC!). You typically would like to use it this way: class MyObjectAdmin(FieldLevelPermissionsAdmin): def can_view_field(self, request, object, field_name): """ Boolean method, returning True if user allowed to view field with name field_name. user is stored in the request object, object is None only if object does not exist yet """ ...your code... def can_change_field(self, request, object, field_name): """ Boolean method, returning True if user allowed to change field with name field_name. user is stored in the request object, object is None only if object does not exist yet """ ...your code... def queryset(self, request): """ Method of ModelAdmin, override it if you want to change list of objects visible by the current user. """ mgr = self.model._default_manager if request.user.is_superuser: return mgr.all() filters = Q(creator=request.user)|Q(owner=request.user) return mgr.filter(filters)

  • newforms
  • admin
  • field
  • permissions
  • workflow
  • customize
  • customization
  • field-level
  • row
Read More

4 snippets posted so far.