Ticket #9938: 9938.patch

File 9938.patch, 775 bytes (added by bstpierre, 16 years ago)

proposed patch

  • django/forms/models.py

     
    705705            value = self.queryset.get(**{key: value})
    706706        except self.queryset.model.DoesNotExist:
    707707            raise ValidationError(self.error_messages['invalid_choice'])
     708        except ValueError:
     709            # Raised when string is passed.
     710            raise ValidationError(self.error_messages['invalid_choice'])
     711        except OverflowError:
     712            # Raised when ridiculously large integer is passed.
     713            raise ValidationError(self.error_messages['invalid_choice'])
    708714        return value
    709715
    710716class ModelMultipleChoiceField(ModelChoiceField):
Back to Top