﻿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
17675	using date filter with regroup tag not working with 1.4 TZ	Preston Holmes	Aymeric Augustin	"If I try to use the date filter with regroup like so

{{{
{% regroup page_list by created|date:""B"" as months %}
}}}

where page_list is a QS of PageRevision objects, I get an attribute error 

{{{
'PageRevision' object has no attribute 'use_tz'
}}}

The issue seems to be that when localtime is called (inside template/base.py - resolve) with context.use_tz the context at this point is a PageRevision instance

I'm not sure, but perhaps this is some interaction of the way regroup uses a lambda and resolve?

Here is the tail of the traceback:

{{{
File ""/Users/preston/Projects/Python/virtualenvs/lcah-apps/lib/python2.7/site-packages/django/template/debug.py"" in render_node
  74.             return node.render(context)
File ""/Users/preston/Projects/Python/virtualenvs/lcah-apps/lib/python2.7/site-packages/django/template/defaulttags.py"" in render
  301.             groupby(obj_list, lambda v, f=self.expression.resolve: f(v, True))
File ""/Users/preston/Projects/Python/virtualenvs/lcah-apps/lib/python2.7/site-packages/django/template/defaulttags.py"" in <lambda>
  301.             groupby(obj_list, lambda v, f=self.expression.resolve: f(v, True))
File ""/Users/preston/Projects/Python/virtualenvs/lcah-apps/lib/python2.7/site-packages/django/template/base.py"" in resolve
  598.                 obj = localtime(obj, context.use_tz)

Exception Type: AttributeError at /wiki/special/recent/
Exception Value: 'PageRevision' object has no attribute 'use_tz'
}}}

If this is verified - it would be a 1.4 regression

"	Bug	closed	Core (Other)	1.4-alpha-1	Release blocker	fixed			Ready for checkin	1	0	0	0	0	0
