1. Add ManyToManyField() to models.py them migrate to the database
[python] operating_system = models.ManyToManyField(Operating_system, blank=True) [/python]
2. In views.py, use the following to save ManyToManyField objects
[python] form.save_m2m() [/python]
3. Use the following to display the content of ManyToManyField in the template
[python] {{instance.operating_system.all}} [/python]
Hey trying to do the same, but the form keeps throwing not a valid value error when I submit.
How did you do it on your html template?
You can right-click the dropdown and select view page source.
Hello, I am confused how you are able to only show OS name. I have the modelChoice working but the text displayed is “tableName object (instance name)”
I would like to determine how to display “instance name” only in the dropdown
Which Django version do you have?