diff --git a/AUTHORS b/AUTHORS index cb69ebd0b0..1e56bd3412 100644 --- a/AUTHORS +++ b/AUTHORS @@ -278,6 +278,7 @@ answer newbie questions, and generally made Django that much better: Frank Tegtmeyer thebjorn Zach Thompson + Deepak Thukral tibimicu@gmax.net tobias@neuyork.de Tom Tobin diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 795f8936bd..3792a30a88 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -538,7 +538,12 @@ class DateField(Field): def get_db_prep_save(self, value): # Casts dates into string format for entry into database. if value is not None: - value = value.strftime('%Y-%m-%d') + try: + value = value.strftime('%Y-%m-%d') + except AttributeError: + # If value is already a string it won't have a strftime method, + # so we'll just let it pass through. + pass return Field.get_db_prep_save(self, value) def get_manipulator_field_objs(self):