mirror of
https://github.com/jazzband/django-avatar.git
synced 2026-03-16 22:20:30 +00:00
Added management command to rebuild avatars. This is useful for when an administrator wishes to change the size of the auto-generated avatar sizes.
git-svn-id: http://django-avatar.googlecode.com/svn/trunk@25 c76b2324-5f53-0410-85ac-b1078a54aeeb
This commit is contained in:
parent
3a56d30243
commit
7d6c3f70d5
1 changed files with 15 additions and 0 deletions
15
avatar/management/commands/rebuild_avatars.py
Normal file
15
avatar/management/commands/rebuild_avatars.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from django.core.management.base import NoArgsCommand
|
||||
from django.conf import settings
|
||||
|
||||
from avatar.models import Avatar
|
||||
|
||||
AUTO_GENERATE_AVATAR_SIZES = getattr(settings, 'AUTO_GENERATE_AVATAR_SIZES', (80,))
|
||||
|
||||
class Command(NoArgsCommand):
|
||||
help = "Import avatars from Gravatar, and store them locally."
|
||||
|
||||
def handle_noargs(self, **options):
|
||||
for avatar in Avatar.objects.all():
|
||||
for size in AUTO_GENERATE_AVATAR_SIZES:
|
||||
print "Rebuilding Avatar id=%s at size %s." % (avatar.id, size)
|
||||
avatar.create_thumbnail(size)
|
||||
Loading…
Reference in a new issue