2👍
✅
You may need to pass instance request.user.profile
to the form.
def complete_profile(request):
if request.user.is_authenticated():
if request.method == 'POST':
form = ProfileForm(request.POST, instance=request.user.profile)
if form.is_valid():
#form.instance.user = request.user
form.save()
return render(request, 'home.html')
else:
form = ProfileForm()
return render(request, 'complete_profile.html', {'form': form})
else:
return render(request, 'login.html')
2👍
form = ProfileForm(request.POST,instance=request.user.profile)
if form.is_valid():
form.save()
try this
- [Django]-Modelform fails is_valid w/o setting form.errors
- [Django]-Youtube Plugin for Django Ckeditor Updated
- [Django]-Can't compare datetime.datetime to builtin_function_or_method
- [Django]-Webservices in Django
Source:stackexchange.com