4

In the Django admin screen for displaying lists of users (with the header, Select user to change), there are the fields username/email, etc and staff_status. I would like to add the user's active status to that display.

Although most of the django-admin customization questions seem to involve extending the admin model - since this field already exists, I would think it only requires changing a template. However, I have looked at all the templates under admin and edit-inline, and if it's one of those, I can't tell. :)

So how do I add active status to the user-list display? A template change, and if so, which one? Note - I'm currently using Django 1.2, not the latest development version.

2 Answers 2

5

It's in http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/admin.py:

class UserAdmin,

Add it to list_display (see django doc):

list_display = ('username', 'email', 'first_name', 'last_name', 'is_staff',
                'is_active')
Sign up to request clarification or add additional context in comments.

4 Comments

code.djangoproject.com/browser/django/tags/releases/1.2/django/… --- it's there also in 1.2 (directly under the auth directory)
Arg, you're right, sorry - clicked on the wrong directory (sigh).
The problem with that is that one day you will make an update, and your changes will be gone. Better look at this answer
Please refer to the answer provided by @RafaelSentiesMartielli. That's the proper one!
1

Try this (Worked for me)-

from django.contrib.auth.admin import UserAdmin

UserAdmin.list_display = (....,'is_active')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.