相关的
Q&A
我的形式课是:
class RoomForm(ModelForm):
room_in_type = forms.ChoiceField(choices = [(elem[0], elem[1]) for elem in filter(lambda x: x[2] == False, memcache.Client().get("room_in_type_choices"))], widget=forms.RadioSelect())
class Meta:
model = Room
def __init__(self, *args, **kwargs):
super(RoomForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_method = 'post'
self.helper.form_action = form_action
self.helper.label_class = 'col-md-8'
self.helper.form_class = 'form-horizontal'
self.helper.layout = Layout(
InlineRadios('room_in_type', required=True, css_classes="col-md-8", template='some_template.html'),
Field('country', required=True, css_class="country-container", wrapper_class ='toto-class'),
Field('fb_user', type='hidden')
)
我的模板的相关部分是:
{{ form.country | as_crispy_field}}
{{ form.room_in_type | as_crispy_field}}
也不
template='some_template.html'
也没有
wrapper_class ='toto-class'
被认为
但如果我表现出来
{% crispy form%}
两个领域都发生了。
我的问题是:
当渲染为单个场时,不可能给出这些参数吗?