views:

29

answers:

2

Hey, I want to add custom buttom to the django admin site, and the users must be administrators, I do not expect you tell me how to do in each step, but please brief write the right approach, if you also can provide some reading URLs, that's gonna be awesome.

+1  A: 

http://docs.djangoproject.com/en/dev/intro/tutorial02/ - "Customize the admin form" shows how to modify the admin section of an app.

http://docs.djangoproject.com/en/dev/topics/auth/ - "get_group_permissions()" will allow you to get the group permissions of a user. "has_perm()" returns true for a single permission.

http://docs.djangoproject.com/en/dev/howto/custom-management-commands/ - how to customize django management

http://docs.djangoproject.com/en/dev/ref/contrib/admin/ - "ModelAdmin" can be used to specify a template for the admin site

Using these, you can put together a custom template with any custom controls and only show them if the user has a specific permission.

Scott
A: 

You can copy from django /django/contrib/admin/templates/admin/base.html (or base_site.html) to your project /templates/admin/base.html then customize base.html

This part {% block footer %}<div id="footer"></div>{% endblock %}

Also this peace of template could help {% if user.is_active and user.is_staff %}

mapcuk