I am new to django, I an updating my userprofile models using forms and view,I need to get the current user who is logged in and I need to update the details for that user
forms.py
class ProfileForm(forms.ModelForm):
class Meta:
model = UserProfile
fields = ('gender','email_id','mobile_number','date_of_birth')
View.py
def update_UserProfile_views(request):
if request.method == "POST":
form = ProfileForm(request.POST)
if form.is_valid():
profile = form.save(commit=False)
profile.save()
else:
form = ProfileForm()
return render(request, 'base.html', {'form': form})