#17675: using date filter with regroup tag not working with 1.4 TZ
------------------------------+-------------------------
Reporter: ptone | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.4-alpha-1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+-------------------------
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
--
Ticket URL: <https://code.djangoproject.com/ticket/17675>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.