diff options
| author | Tim Graham <timograham@gmail.com> | 2017-01-26 13:35:39 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-26 13:35:39 -0500 |
| commit | af598187ecd9ddf398aa7a68a2b955599ddf3ae1 (patch) | |
| tree | 5418c787e59bd3fb45a69c588d518b802b8719ac | |
| parent | d1bab24e0144d14513a1411503c95ececb425188 (diff) | |
Removed unnecessary force_text() in BaseTemporalField.to_python().
This seems unneeded since its introduction in
da3aa22d04d6452f87abbb1a0fee8a90a61eff5b.
| -rw-r--r-- | django/forms/fields.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/django/forms/fields.py b/django/forms/fields.py index 2994ece1ce..e12702f713 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -390,17 +390,13 @@ class BaseTemporalField(Field): self.input_formats = input_formats def to_python(self, value): - # Try to coerce the value to unicode. - unicode_value = force_text(value, strings_only=True) - if isinstance(unicode_value, str): - value = unicode_value.strip() - # If unicode, try to strptime against each input format. - if isinstance(value, str): - for format in self.input_formats: - try: - return self.strptime(value, format) - except (ValueError, TypeError): - continue + value = value.strip() + # Try to strptime against each input format. + for format in self.input_formats: + try: + return self.strptime(value, format) + except (ValueError, TypeError): + continue raise ValidationError(self.error_messages['invalid'], code='invalid') def strptime(self, value, format): |
