diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-03-31 21:48:29 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-03-31 21:48:29 +0000 |
| commit | 795697dc225af79958f16610906df3a31a4b2eaa (patch) | |
| tree | 5bdf0358fa318a3c72164568145a9a49c04028f6 /django | |
| parent | 67a58801623cccd55ecdd7d21f7b2dc487175c03 (diff) | |
[1.0.X] Fixed #8746: Check data in raw_id_fields more closely. Thanks, dgouldin
Backport of r10233 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10294 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/forms/models.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/django/forms/models.py b/django/forms/models.py index 57dca31fca..abdb83f6a9 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -740,6 +740,7 @@ class ModelMultipleChoiceField(ModelChoiceField): 'list': _(u'Enter a list of values.'), 'invalid_choice': _(u'Select a valid choice. %s is not one of the' u' available choices.'), + 'invalid_pk_value': _(u'"%s" is not a valid value for a primary key.') } def __init__(self, queryset, cache_choices=False, required=True, @@ -762,6 +763,8 @@ class ModelMultipleChoiceField(ModelChoiceField): obj = self.queryset.get(pk=val) except self.queryset.model.DoesNotExist: raise ValidationError(self.error_messages['invalid_choice'] % val) + except ValueError: + raise ValidationError(self.error_messages['invalid_pk_value'] % val) else: final_values.append(obj) return final_values |
