📜  django 表单列表选项 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:39.792000             🧑  作者: Mango

代码示例1
# iterable 
GEEKS_CHOICES =( 
    ("1", "One"), 
    ("2", "Two"), 
    ("3", "Three"), 
    ("4", "Four"), 
    ("5", "Five"), 
) 
  
# creating a form  
class GeeksForm(forms.Form): 
    geeks_field = forms.ChoiceField(choices = GEEKS_CHOICES)