Django用户配置文件表单验证问题

时间:2011-09-24 21:36:48

标签: django forms validation profile

我正在尝试将用户配置文件模块实现到我的django项目中,但是我收到了这个错误:

Form 'SignupForm' could be validated, while 'ProfileForm' couldn't. Please make sure the two classes are compatible. Validation errors were: * user
  * Обязательное поле.(can't be blank)

我的代码:

http://pastie.org/2586199

任何人都可以帮助我吗? 提前谢谢。

1 个答案:

答案 0 :(得分:2)

您可能只需手动将Model meta属性设置为配置文件类,而不是从设置中抓取它:

from some.module import MyProfile
class ProfileForm(forms.ModelForm):
    pass

    class Meta:
        model = MyProfile

该代码似乎大大超过了一个相当简单的操作