django 自定义数据校验

http://stackoverflow.com/questions/16231183/django-how-to-override-clean-method-in-a-subclass-of-custom-form

 1 class SubClassForm(MyCustomForm):
 2 # ... additional form fields here
 3 
 4 def clean(self):
 5     # Then call the clean() method of the super  class
 6     cleaned_data = super(SubClassForm, self).clean()
 7     # ... do some cross-fields validation for the subclass 
 8 
 9     # Finally, return the cleaned_data
10     return cleaned_data

 

posted @ 2015-03-11 23:47  r3call  阅读(465)  评论(0编辑  收藏  举报