Skip to content

Commit

Permalink
dispatch avatar_updated signal from admin as well
Browse files Browse the repository at this point in the history
  • Loading branch information
n0phx committed Jun 26, 2013
1 parent b8844d8 commit ba38663
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions avatar/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

from avatar.models import Avatar
from avatar.templatetags.avatar_tags import avatar
from avatar.signals import avatar_updated
from avatar.util import User


class AvatarAdmin(admin.ModelAdmin):
list_display = ('get_avatar', 'user', 'primary', "date_uploaded")
list_filter = ('primary',)
Expand All @@ -17,4 +19,9 @@ def get_avatar(self, avatar_in):
get_avatar.short_description = _('Avatar')
get_avatar.allow_tags = True

def save_model(self, request, obj, form, change):
super(AvatarAdmin, self).save_model(request, obj, form, change)
avatar_updated.send(sender=Avatar, user=request.user, avatar=obj)


admin.site.register(Avatar, AvatarAdmin)

0 comments on commit ba38663

Please sign in to comment.