summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2005-08-16 18:28:00 +0000
committerAdrian Holovaty <adrian@holovaty.com>2005-08-16 18:28:00 +0000
commitf21ff30b104ef1eedcfebd230a98fef4b6cc7ebd (patch)
tree1b5e7ae9b61eee7045fe7e04edc746f08e2e93d8 /django
parent7d374ad5973ff5b14e996a38e078c7d46646ae5d (diff)
Small formatting change to validation error in [516], to be consistent with other validation errors.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@517 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/core/meta/fields.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/django/core/meta/fields.py b/django/core/meta/fields.py
index 8cf61d3176..30b5ef7c0c 100644
--- a/django/core/meta/fields.py
+++ b/django/core/meta/fields.py
@@ -587,11 +587,11 @@ class ManyToManyField(Field):
else:
choices = self.get_choices(include_blank=False)
return [curry(formfields.SelectMultipleField, size=min(max(len(choices), 5), 15), choices=choices)]
-
+
def get_m2m_db_table(self, original_opts):
"Returns the name of the many-to-many 'join' table."
return '%s_%s' % (original_opts.db_table, self.name)
-
+
def isValidIDList(self, field_data, all_data):
"Validates that the value is a valid list of foreign keys"
mod = self.rel.to.get_model_module()
@@ -603,9 +603,11 @@ class ManyToManyField(Field):
objects = mod.get_in_bulk(pks)
if len(objects) != len(pks):
badkeys = [k for k in pks if k not in objects]
- raise validators.ValidationError, "Please enter valid %s IDs (the value%s %r %s invalid)" % \
- (self.verbose_name, len(badkeys) > 1 and 's' or '', len(badkeys) == 1 and badkeys[0] or tuple(badkeys), len(badkeys) == 1 and "is" or "are")
-
+ raise validators.ValidationError, "Please enter valid %s IDs. The value%s %r %s invalid." % \
+ (self.verbose_name, len(badkeys) > 1 and 's' or '',
+ len(badkeys) == 1 and badkeys[0] or tuple(badkeys),
+ len(badkeys) == 1 and "is" or "are")
+
class OneToOneField(IntegerField):
def __init__(self, to, to_field=None, rel_name=None, **kwargs):
kwargs['name'] = kwargs.get('name', 'id')