Answer the question
In order to leave comments, you need to log in
How to make a form on which you can edit fields from two models?
There is one view on which you need to display a form with the following fields:
django.forms.Form
, define the fields I need in it, and use FormView
, but as for me, this is a crutch. Is there a more elegant way? auth.User
Do not offer to expand :-)
Answer the question
In order to leave comments, you need to log in
<form>
{% csrf_token %}
{{ model_form_user }}
{{ model_form_profile }}
<button type="submit">
Extend auth.User not suggestthen suffer further with such questions
elitehttps://ru.wiktionary.org/wiki/%D1%8D%D0%BB%D0%B5%...
What is the purpose of the form? If you create a new user, then you still have to fiddle with the form, and determine what this field will be stored in this model, but that field to another model here is just the Form that will help you. If another object is created on the basis of this, then it probably makes sense to design a model for these purposes. Of course, you can do without the form classes at all, and do everything manually in the view.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question