mirror of
https://github.com/jazzband/django-avatar.git
synced 2026-03-16 22:20:30 +00:00
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:
parent
559eb4ae99
commit
3a56d30243
1 changed files with 3 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue