﻿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
12891	wishlist: allow .dates() query to span relations	Tilman Koschnick	nobody	"At the moment, the dates() query only accepts field parameters that do not span relations. It would be nice if support for more complex cases was added, so that a query like this would be possible:

{{{
queryset.dates('foreignkey__date', 'year')
}}}

I currently use the following hack to work around this:

{{{
    # check if date_field spans relations
    fields = date_field.split('__')
    for field in fields[:-1]:
        relation_field = getattr(queryset.model, field)
        queryset = relation_field.field.rel.to.objects.all()
    dates = queryset.dates(fields[-1], 'year')
}}}"		closed	Database layer (models, ORM)	1.2-beta		wontfix			Unreviewed	0	0	0	0	0	0
