django/django — pull request #2004 by hugorodgerbrown (2013-11-28 18:02:11+00:00)
Title: [1.5.x] Fixed #21523 — added additional parsing to DateField.to_python()

The to_python method attempts to convert a DateField value to a python
datetime.date object instance. It checks for datetime.date, datetime.
datetime instances, and if neither of those it then attempts to parse
the value as a string. This can fail if the value is an object that is
not a date, but is being used to represent one - i.e. a mock object.

Previously there was a call to django.utils.encoding.smart_str before
the call to parse_date, which essentially converted the value to its
unicode representation. This was removed when the smart_str method was
removed (in favour of smart_text). I have put a call to smart_text back
in.