コード例 #1
0
ファイル: views.py プロジェクト: ryanoflaherty/OpenEMR-API
	def post(self, request):
		form = UserUpdateForm()
		if form.is_valid():
			form.save()
			request.session["temp_user"] = {
				'username': request.POST["username"],
				'new': False,
			}
			return redirect('/accounts/register/done/')
		else:
			return render(request, self.template_name, {'user_update_form': form})
コード例 #2
0
ファイル: views.py プロジェクト: akirameng/ordering-system
 def post(self, request, *args, **kwargs):
     updateForm = UserUpdateForm(request.POST, request.FILES, instance=request.user)
     if updateForm.is_valid():
         email = updateForm.cleaned_data['email']
         users = CustomUser.objects.filter(email=email)
         if len(users) >= 1 and users[0] != request.user:
             errors = updateForm._errors.setdefault("email", ErrorList())
             errors.append(u"This email has been register with another account.")
         else:
             updateForm.save();
             updateForm = UserUpdateForm(instance=request.user)
     return render(request, 'accounts/profile.html', {'userUpdateForm': updateForm})