Monday, November 1, 2010

Re: Add admin action to Django User

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User

class MyUserAdmin(UserAdmin):
actions = ['my_action']

def my_action(self, request, queryset):
# stuff here...

admin.site.unregister(User)
admin.site.register(User, MyUserAdmin)

Take a look here for more info:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/
http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/

Best regards,
Enrico

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment