django modelform booleanfield没有按要求出现

时间:2017-11-30 15:39:39

标签: django django-forms

我试图渲染一个模型,该模型具有模型中的booleanfield(是,没有选择),无法显示为默认值(我认为是默认值)。

模型字段是:

BOOL_CHOICES = ((True, 'Yes'), (False, 'No'))
same_address = models.BooleanField(choices=BOOL_CHOICES)

在表单中使用(并且不会在表单构造函数或其他地方进行更改):

  ....
  class Meta:
    model = Address
    fields = [

        'same_address',
    ]

0 个答案:

没有答案
相关问题