mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #13149 -- The admin ForeignKeyRawIdWidget now properly handles non-integer values. Thanks, Chris Adams.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13751 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1006,7 +1006,7 @@ class ModelChoiceField(ChoiceField):
|
||||
try:
|
||||
key = self.to_field_name or 'pk'
|
||||
value = self.queryset.get(**{key: value})
|
||||
except self.queryset.model.DoesNotExist:
|
||||
except (ValueError, self.queryset.model.DoesNotExist):
|
||||
raise ValidationError(self.error_messages['invalid_choice'])
|
||||
return value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user