S
S
sortfact3332020-11-20 21:47:57
Django
sortfact333, 2020-11-20 21:47:57

How to display the selection model?

I have a select model

car = models.IntegerField('color car', choices=Color.choices, default=1)

I need to display all possible options.
Can I do it automatically via for in html?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-11-20
@bacon

ModelForm does this automatically, just like reading the form docs manually.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question