def user_profile(request): profile = Profile.objects.get(user=request.user) form = ProfileForm(instance=profile) if request.method == 'POST': form = ProfileForm(request.POST, instance=profile) if form.is_valid(): form.save() messages.success(request, "Change Saved!!") form = ProfileForm(instance=profile) return render(request, 'App_Login/change_profile.html', context={'form':form})
def user_profile(request): profile=Profile.objects.get(user=request.user) form=ProfileForm(instance=profile) if request.method=='POST': form=ProfileForm(request.POST, instance=profile) if form.is_valid(): form.save() messages.success(request,"your profile is changed successfully") form=ProfileForm(instance=profile) return redirect("App_Payment:checkout") return render(request,'App_Login/change_profile.html',context={'form':form})
def user_profile(request): profile = UserProfile.objects.get(user=request.user) form = ProfileForm(instance=profile) if request.method == "POST": form = ProfileForm(request.POST, instance=profile) if form.is_valid(): form.save() messages.success(request, "Your profile updated") form = ProfileForm(instance=profile) return render(request, "App_Login/profilechange.html", context={'form': form})
def userProfile(request): profile = Profile.objects.get(user=request.user) form = ProfileForm(instance=profile) if request.method == 'POST': form = ProfileForm(request.POST, instance=profile) if form.is_valid(): form.save() messages.success(request, "Profile saved") return HttpResponseRedirect(reverse('App_Shop:home')) return render(request, 'App_Login/change_profile.html', context={ 'title': 'Profile', 'form': form })