0

由于某种原因,当所有其他字段都显示时,它没有显示。

forms.py我有

class addonForm(Form):
    choices = [('true','true'),('false','false')]
    name = CharField()
    fixed = ChoiceField(choices=choices)
    depth = DecimalField()

views.py中我有

def myView(request):
    context = RequestContext(request)
    form = addonForm()
    context.update({'form':form})

    return render_to_response('addonPage.html',context)

在模板addonPage.html我有

...
{{ form }}
...

然而在我的模板中,我只在表单中显示名称固定元素。我不明白我做错了什么。

4

1 回答 1

0

Bah, it was exactly as August Men said. I wasn't explicitly importing the field from django.forms so I guess it was using the django.models version.

于 2013-10-07T18:52:05.243 回答