Made avatar selection more clear by providing initial data for the form.

git-svn-id: http://django-avatar.googlecode.com/svn/trunk@24 c76b2324-5f53-0410-85ac-b1078a54aeeb
This commit is contained in:
Eric Florenzano 2008-08-16 05:53:55 +00:00
parent 559eb4ae99
commit 3a56d30243

View file

@ -114,9 +114,11 @@ def change(request, extra_context={}, next_override=None):
avatars = Avatar.objects.filter(user=request.user).order_by('-primary')
if avatars.count() > 0:
avatar = avatars[0]
kwargs = {'initial': {'choice': avatar.id}}
else:
avatar = None
primary_avatar_form = PrimaryAvatarForm(request.POST or None, user=request.user)
kwargs = {}
primary_avatar_form = PrimaryAvatarForm(request.POST or None, user=request.user, **kwargs)
if request.method == "POST":
if 'avatar' in request.FILES:
path = avatar_file_path(user=request.user,