comparison bio/views.py @ 1123:ce6a0c12cbf3

Convert edit profile to V3 design.
author Brian Neal <bgneal@gmail.com>
date Wed, 17 Aug 2016 20:39:07 -0500
parents 2574cd24773e
children 4f81c9fe8705
comparison
equal deleted inserted replaced
1122:2574cd24773e 1123:ce6a0c12cbf3
103 ####################################################################### 103 #######################################################################
104 104
105 @login_required 105 @login_required
106 def edit_profile(request): 106 def edit_profile(request):
107 if request.method == 'POST': 107 if request.method == 'POST':
108 if request.POST.get('submit_button', 'Cancel') == 'Cancel':
109 return redirect('bio-me')
110 profile = request.user.profile 108 profile = request.user.profile
111 user_form = EditUserForm(request.POST, instance=request.user) 109 user_form = EditUserForm(request.POST, instance=request.user)
112 profile_form = EditUserProfileForm(request.POST, instance=profile) 110 profile_form = EditUserProfileForm(request.POST, instance=profile)
113 if user_form.is_valid() and profile_form.is_valid(): 111 if user_form.is_valid() and profile_form.is_valid():
114 user_form.save() 112 user_form.save()
122 profile_form = EditUserProfileForm(instance=profile) 120 profile_form = EditUserProfileForm(instance=profile)
123 121
124 return render(request, 'bio/edit_profile.html', { 122 return render(request, 'bio/edit_profile.html', {
125 'user_form': user_form, 123 'user_form': user_form,
126 'profile_form': profile_form, 124 'profile_form': profile_form,
125 'V3_DESIGN': True,
127 }) 126 })
128 127
129 ####################################################################### 128 #######################################################################
130 129
131 @login_required 130 @login_required