1π
β
If using modelForms
you well need two distinct forms β one for the User
model and one for the Profile
model. You then display both within the same <form>
tag in your template, and validate / save both in your view.
The other solution is to define a plain (non βmodelβ) form with fields for both models, and write the save
method by yourself.
0π
Assuming that form
is an User
object which youβre using in the template, you should be able to access the dob
field using form.profile.dob
.
π€Anomitra
- Print form validation errors in Django
- Using querydict item for if-statement
- Multiple messages.error Django
- Django EmailMessage send() works and then gives HTTP Error 400: Bad Request
0π
Many thanks to Bruno who gave the correct answer above. It led me to the following link:
I hope it helps someone.
π€Alan Tingey
- Django does not find static files which are not tied to specific apps
- How to implement chart.js with each field in the model? Django
- How to disable/enable a button on input empty/full while keeping permissions
Source:stackexchange.com