def user_change(request): current_user = request.user form = UserProfileChange(instance=current_user) if request.method == 'POST': form = UserProfileChange(request.POST,instance=current_user) if form.is_valid(): form.save() form = UserProfileChange(instance=current_user) return render(request,'App_Login/change_profile.html',context={'form':form})
def user_change(request): current_user=request.user form=UserProfileChange(instance=current_user) if request.method == 'POST': form = UserProfileChange(request.POST,instance=current_user) # value replace kore value update korbe if form.is_valid(): form.save() form = UserProfileChange(instance=current_user) #updated value reload korbe return render(request,'App_Login/change_profile.html',context={'form':form})
def user_change(request): current_user = request.user form = UserProfileChange(instance=current_user) if request.method == 'POST': form = UserProfileChange(request.POST, instance=current_user) if form.is_valid(): form.save() form = UserProfileChange(instance=current_user) messages.success(request, "Information Updated Successfully!!") return HttpResponseRedirect(reverse('App_Login:profile')) return render(request, 'App_Login/change_profile.html', context={'form': form})
def user_change(request): current_user = request.user form = UserProfileChange(instance=current_user) if request.method == 'POST': form = UserProfileChange( request.POST, instance=current_user ) #request.POST er value gulo dea instance er value replace korlm if form.is_valid(): form.save() form = UserProfileChange( instance=current_user ) #16:00 again load korlm notun info gulo, na hoe puraton info gulai dekhabe return render(request, 'App_Login/change_profile.html', context={'form': form})
def user_change(request): current_user = request.user form = UserProfileChange(instance=current_user) profile_form = ProfilePic(instance=request.user.user_profile) if request.method == 'POST': form = UserProfileChange(request.POST, instance=current_user) profile_form = ProfilePic(request.POST, request.FILES, instance=request.user.user_profile) if form.is_valid() and profile_form.is_valid(): user = form.save() profile = profile_form.save(commit=False) profile.user = user profile.save() form = UserProfileChange(instance=current_user) return render(request, 'App_Login/change_profile.html', context={ 'form': form, 'profile_form': profile_form })