Python 无法使用Crispy表单手动设置表单属性

Python 无法使用Crispy表单手动设置表单属性,python,django,forms,django-crispy-forms,Python,Django,Forms,Django Crispy Forms,我一直在用django crispy表单、django 1.8.4和django-crispy-forms-1.5.2创建一个模型表单。我无法更改表单标记属性 我已尝试设置self.helper.form_tag=False,但它仍会生成一个标记。我尝试设置其他属性,如表单_操作,但这也不起作用,表单标记保持不变(最终的HTML仍然是) 在视图.py中: class RegisterStudentView(CreateView): template_name = "register_s

我一直在用django crispy表单、django 1.8.4和django-crispy-forms-1.5.2创建一个模型表单。我无法更改表单标记属性

我已尝试设置
self.helper.form_tag=False
,但它仍会生成一个
标记。我尝试设置其他属性,如
表单_操作
,但这也不起作用,表单标记保持不变(最终的HTML仍然是

视图.py
中:

class RegisterStudentView(CreateView):

    template_name = "register_student.html"
    model = Student
    form_class = StudentRegistrationForm

    def form_valid(self, form):
        form.save()
        return HttpResponseRedirect('dashboard')
class StudentRegistrationForm(ModelForm):
    def __init__(self, *args, **kwargs):
        super(StudentRegistrationForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_tag = False

    class Meta:
        model = Student
        exclude = ['is_active', 'is_overdue', 'personid', 'tertiary_cell']
forms.py
中:

class RegisterStudentView(CreateView):

    template_name = "register_student.html"
    model = Student
    form_class = StudentRegistrationForm

    def form_valid(self, form):
        form.save()
        return HttpResponseRedirect('dashboard')
class StudentRegistrationForm(ModelForm):
    def __init__(self, *args, **kwargs):
        super(StudentRegistrationForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_tag = False

    class Meta:
        model = Student
        exclude = ['is_active', 'is_overdue', 'personid', 'tertiary_cell']

任何帮助都将不胜感激。

正如Awwest所评论的,问题在于crispy forms函数周围有一个硬编码的
标记:

<form>
  {% crispy %}
</form>

{%crispy%}

基本上,crispy forms使用了现有的表单标签,而没有创建我想要的新标签。

您的html模板中有什么?表单标签可能在那里,而不是由crispy formsThanks@awwester生成的,这正是我的问题。有一个表单标签围绕着我对crispy forms的调用。