summaryrefslogtreecommitdiff
path: root/django/forms/formsets.py
diff options
context:
space:
mode:
authorLoic Bistuer <loic.bistuer@sixmedia.com>2013-06-05 14:55:05 -0400
committerTim Graham <timograham@gmail.com>2013-06-18 08:01:17 -0400
commitee77d4b25360a9fc050c32769a334fd69a011a63 (patch)
tree1f20a040970dc53d2e4977d79fe66ea7626cd932 /django/forms/formsets.py
parentf34cfec0fa1243b4a3b9865b961a2360f211f0d8 (diff)
Fixed #20199 -- Allow ModelForm fields to override error_messages from model fields
Diffstat (limited to 'django/forms/formsets.py')
-rw-r--r--django/forms/formsets.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index 79e1c2298a..edd362c595 100644
--- a/django/forms/formsets.py
+++ b/django/forms/formsets.py
@@ -85,7 +85,10 @@ class BaseFormSet(object):
if self.is_bound:
form = ManagementForm(self.data, auto_id=self.auto_id, prefix=self.prefix)
if not form.is_valid():
- raise ValidationError('ManagementForm data is missing or has been tampered with')
+ raise ValidationError(
+ _('ManagementForm data is missing or has been tampered with'),
+ code='missing_management_form',
+ )
else:
form = ManagementForm(auto_id=self.auto_id, prefix=self.prefix, initial={
TOTAL_FORM_COUNT: self.total_form_count(),
@@ -315,7 +318,9 @@ class BaseFormSet(object):
self.management_form.cleaned_data[TOTAL_FORM_COUNT] > self.absolute_max:
raise ValidationError(ungettext(
"Please submit %d or fewer forms.",
- "Please submit %d or fewer forms.", self.max_num) % self.max_num)
+ "Please submit %d or fewer forms.", self.max_num) % self.max_num,
+ code='too_many_forms',
+ )
# Give self.clean() a chance to do cross-form validation.
self.clean()
except ValidationError as e: