def edit(request): title = "редактирование" if request.method == "POST": edit_form = ShopUserEditForm(request.POST, request.FILES, instance=request.user) profile_form = ShopUserProfileEditForm( request.POST, instance=request.user.shopuserprofile) if edit_form.is_valid() and profile_form.is_valid(): edit_form.save() return HttpResponseRedirect(reverse("auth:edit")) else: edit_form = ShopUserEditForm(instance=request.user) profile_form = ShopUserProfileEditForm( instance=request.user.shopuserprofile) content = { "title": title, "edit_form": edit_form, "profile_form": profile_form, "media_url": settings.MEDIA_URL } return render(request, "authnapp/edit.html", content)
content = {"title": title, "register_form": register_form} return render(request, "authnapp/register.html", content) <<<<<<< HEAD @transaction.atomic ======= >>>>>>> master def edit(request): title = "редактирование" if request.method == "POST": edit_form = ShopUserEditForm(request.POST, request.FILES, instance=request.user) <<<<<<< HEAD profile_form = ShopUserProfileEditForm(request.POST, instance=request.user.shopuserprofile) if edit_form.is_valid() and profile_form.is_valid(): ======= if edit_form.is_valid(): >>>>>>> master edit_form.save() return HttpResponseRedirect(reverse("auth:edit")) else: edit_form = ShopUserEditForm(instance=request.user) <<<<<<< HEAD profile_form = ShopUserProfileEditForm(instance=request.user.shopuserprofile) content = {"title": title, "edit_form": edit_form, "profile_form": profile_form, "media_url": settings.MEDIA_URL} return render(request, "authnapp/edit.html", content)