难以找到不端行为。经过几个小时后,看起来Django看起来像是AttributeError
,可能还有其他例外:
from django import forms
class MyBaseForm(forms.ModelForm):
class Meta:
model = MyModel
fields = ('field1', 'field2', )
…
class MyForm(MyBaseForm):
def clean_field1(self):
super(MyForm, self).clean_field1() # calling non-exitsting method
# instead of AttributeError exception being raised,
# following code is not executed without a warning
return self.another_field_handler('field1')
有人可以解释这种令人惊讶的行为对Django表格是否正常吗?一些链接在哪里记录?