How do I use Django's form framework for select options?

后端 未结 4 1089
旧巷少年郎
旧巷少年郎 2021-02-12 15:15

http://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.Select

Here, it says I can do SELECT widgets. But how do I do that? It doesn\'t show any example on

4条回答
  •  旧时难觅i
    2021-02-12 15:25

    CHOICES= (
    ('ME', '1'),
    ('YOU', '2'),
    ('WE', '3'),
    )
    select = forms.CharField(widget=forms.Select(choices=CHOICES))
    

提交回复
热议问题