语法无效:来自django导入表单

时间:2017-10-11 05:02:56

标签: django

Error 我在forms.py中编写了以下代码。我无法理解这有什么问题。这会产生无效的语法

form django import forms

class contactForm(forms.Forms):
    name=forms.CharField(required=False,max_length=100,help_text='100 characters max.')
    email=forms.EmailField(required=True)
    comment=forms.CharField(required=True,widget=forms.Textarea)

1 个答案:

答案 0 :(得分:1)

检查拼写错误:您需要forms.Form forms.Forms

class contactForm(forms.Form):

错误:from而不是form

from django import forms
^^^^