﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26281	Improve utils.formats.date_format() error message when using time formatting with datetime.date	Florian Eßer	Marko Benko	"When using `date_format()` on a `datetime.date` object, I get the following error:
{{{
File ""<project>/<app>/models.py"" in __str__
  104.         return date_format(self.date, format=""%A, %d.%m.%Y"")

File ""<project>/env/lib/python3.4/site-packages/django/utils/formats.py"" in date_format
  151.     return dateformat.format(value, get_format(format or 'DATE_FORMAT', use_l10n=use_l10n))

File ""<project>/env/lib/python3.4/site-packages/django/utils/dateformat.py"" in format
  367.     return df.format(format_string)

File ""<project>/env/lib/python3.4/site-packages/django/utils/dateformat.py"" in format
  37.                 pieces.append(force_text(getattr(self, piece)()))

File ""<project>/env/lib/python3.4/site-packages/django/utils/dateformat.py"" in A
  66.         if self.data.hour > 11:

Exception Type: AttributeError at /
Exception Value: 'datetime.date' object has no attribute 'hour'
}}}

It seems to expect a `datetime.datetime`object, while the docstring for `date_format()` explicitly mentions `datetime.date` as a valid input, too: ''""Formats a datetime.date or datetime.datetime object using a localizable format""''.

'''How to reproduce:'''

models.py:
{{{
from django.db import models
from django.utils.formats import date_format

class ArrivalDate(models.Model):
    date = models.DateField()

    def __str__(self):
        return date_format(self.date, format=""%A, %d.%m.%Y"")
}}}

template.html:
{{{
the date is {{ arrivaldate_instance }}
}}}

settings.py:
{{{
LANGUAGE_CODE = 'de-de'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
}}}

I'm running Django 1.9.2 on Python 3.4"	Cleanup/optimization	closed	Utilities	1.9	Normal	fixed		f.esser@…	Accepted	1	0	0	1	0	0
