Answer the question
In order to leave comments, you need to log in
Django Foreign Key save in Models?
Hello everyone, do not judge strictly, I'm just learning) I have a form in HTML. I send the data from this form using the Post method to the Django server. The server receives this data. Also, I have 2 tables.
The Persons table and the Gender table (in which 2 values are recorded through the admin panel, Male and Female ). The idea is that the user has entered data, one of them is gender, for example Male. I clicked send, and the data was written to the database. The Persons table has a field called Gender that references the Gender table via a Foreign Key. Thanks to this, in the admin panel, I can choose from two values (gender Male or Female) . Here's the question, when I enter data in an HTML form and hit submit, I get an error because I do not understand in what form I should send the value Male or female
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question