Skip to content

Instantly share code, notes, and snippets.

@Wilfred
Created June 27, 2013 13:28
Show Gist options
  • Select an option

  • Save Wilfred/5876397 to your computer and use it in GitHub Desktop.

Select an option

Save Wilfred/5876397 to your computer and use it in GitHub Desktop.
adding custom admin actions for built-in Django models
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment