﻿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
32846	DateMixin.uses_datetime_field does not work when date_field is defined on a related model	Jaap Roes	nobody	"Today I had the need to create a date based archive for a model that stores the date on a related model:

{{{#!python
class Bar(models.Model):
    date = models.DateField()

class Foo(models.Model):
    bar = models.OneToOneField(Bar, on_delete=models.CASCADE)
}}}

with a view like this:

{{{#!python
class FooMonthArchiveView(MonthArchiveView):
    queryset = Foo.objects.all()
    date_field = ""bar__date""
}}}

Django raises an error from `uses_datetime_field` because `bar__date` isn't a field on the `Foo` model.

By overriding `uses_datetime_field` to just return `False` things seem to work just fine.

I'll mark this as a new feature as it isn't explicitly documented that this should work, and hasn't worked for quite a while (for at least since whenever the `uses_datetime_field property` was introduced)"	New feature	closed	Generic views	dev	Normal	duplicate			Unreviewed	0	0	0	0	0	0
