def edit_profile(request): current_user = UserProfile.objects.get(user=request.user) form = EditProfile(instance=current_user) if request.method == 'POST': form = EditProfile(request.POST, request.FILES, instance=current_user) if form.is_valid(): form.save(commit=True) form = EditProfile(instance=current_user) return HttpResponseRedirect(reverse('App_Login:profile')) return render(request, 'App_Login/profile.html', context={'title':'Your Profile', 'form':form})
def edit_profile(request): current_user = UserProfile.objects.get(user=request.user) form = EditProfile(instance=current_user) if request.method == 'POST': form = EditProfile(request.POST, request.FILES, instance=current_user) if form.is_valid(): form.save(commit=True) form = EditProfile(instance=current_user) return redirect('app_login:profile') return render(request, 'profile.html', context={'form': form})
def profile(request): form = PostForm() if request.method == 'POST': form = PostForm(request.POST, request.FILES) if form.is_valid(): form.save(commit=True) form = EditProfile(instance=current_user) return HttpResponseRedirect(reverse('home')) return render(request, 'App_Login/user.html', context={'form':form})
def edit_profile(request): print('hey') current_user = UserProfile.objects.get(user=request.user) form = EditProfile(instance=current_user) if request.method == 'POST': form = EditProfile(request.POST, request.FILES, instance=current_user) if form.is_valid(): form.save(commit=True) form = EditProfile(instance=current_user) return render(request, 'App_Login/profile.html', context={ 'form': form, 'title': 'Edit Profile . Social' })