在 TastyPie obj_create 在我的表单验证之前运行,它似乎被跳过了,为什么?
我的代码
class AccountCreateResource(ModelResource):
class Meta:
queryset = CompanyUser.objects.all()
resource_name = 'accounts/create'
allowed_methods = ['post']
validation = FormValidation(form_class=UserCreationForm)
def obj_create(self, bundle, request=None, **kwargs):
CompanyUser.objects.create_user(email=bundle.data['email'],
company=bundle.data['company'],
password=bundle.data['company'])