def profile_profile(request, template="users/profile.html"):
profile = request.user
REQUIRED_FIELDS = ['first_name', 'last_name', 'email',]
FormClass = forms.models.modelform_factory(Profile, fields=REQUIRED_FIELDS)
form = FormClass(instance=profile)
if request.method == "POST":
form = FormClass(request.POST, instance=profile)
if form.is_valid():
profile = form.save()
profile.save()
return {'form': form,}, template
Немає коментарів:
Дописати коментар