Fix #15126: Better error message when passing invalid options to ModelFo... #1000

merged 1 commit into from Apr 7, 2013


None yet

3 participants



@jezdez jezdez commented on an outdated diff Apr 7, 2013
@@ -187,6 +187,23 @@ def __init__(self, options=None):
self.exclude = getattr(options, 'exclude', None)
self.widgets = getattr(options, 'widgets', None)
+ def _validate(self, form_class):
jezdez Apr 7, 2013 Member

Please don't add a new private method, just do this check in __new__.

@jezdez jezdez and 1 other commented on an outdated diff Apr 7, 2013
@@ -228,6 +229,22 @@ class Meta:
+ def test_limit_inexistant_field(self):
+ expected_msg = 'Unknown field(s) (inexistant) specified for Category'
+ with self.assertRaisesMessage(FieldError, expected_msg):
+ class InvalidCategoryForm(forms.ModelForm):
+ class Meta:
+ model = Category
+ fields = ['inexistant']
jezdez Apr 7, 2013 Member

Let's call this non_existent, please.

sebleblanc Apr 7, 2013

Why the underscore? "Nonexistent" is a legitimate word according to the Collins English Dictionary.

jezdez Apr 7, 2013 Member

I don't care about the underscore, only about the non-existence of the word "inexistant".

@jezdez jezdez merged commit b5c0b3d into django:master Apr 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment