From 8e140168d54c14bb8d18d33e38e3e0719952d33c Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Fri, 26 Nov 2010 21:39:00 +0100 Subject: [PATCH] add admin action to set the users avatar to their gravatar --- pyweb/mumble/admin.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyweb/mumble/admin.py b/pyweb/mumble/admin.py index 5b4cab7..306d8e2 100644 --- a/pyweb/mumble/admin.py +++ b/pyweb/mumble/admin.py @@ -163,6 +163,7 @@ class MumbleUserAdmin(admin.ModelAdmin): list_display = [ 'name', 'server', 'owner', 'mumbleid', 'get_acl_admin' ] list_filter = [ 'server' ] search_fields = [ 'owner__username', 'name' ] + actions = [ 'set_texture_from_gravatar' ] ordering = [ 'owner__username' ] form = MumbleUserAdminForm @@ -175,6 +176,12 @@ class MumbleUserAdmin(admin.ModelAdmin): get_acl_admin.short_description = _('Admin on root channel') get_acl_admin.boolean = True + def set_texture_from_gravatar( self, request, queryset ): + for mu in queryset: + mm.setTextureFromGravatar() + + set_texture_from_gravatar.short_description = _( "Set Gravatar as Texture" ) + admin.site.register( MumbleServer, MumbleServerAdmin ) admin.site.register( Mumble, MumbleAdmin )