Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #4441 -- Made a small optimization to the regroup template tag …

…implementation. Thanks, ferringb@gmail.com

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5392 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 603d5cc05a742ec25bd1863954afac58c6679580 1 parent 0e7a49f
Adrian Holovaty adrianholovaty authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 django/template/defaulttags.py
4 django/template/defaulttags.py
View
@@ -237,7 +237,7 @@ def render(self, context):
return ''
output = [] # list of dictionaries in the format {'grouper': 'key', 'list': [list of contents]}
for obj in obj_list:
- grouper = self.expression.resolve(Context({'var': obj}), True)
+ grouper = self.expression.resolve(obj, True)
# TODO: Is this a sensible way to determine equality?
if output and repr(output[-1]['grouper']) == repr(grouper):
output[-1]['list'].append(obj)
@@ -847,7 +847,7 @@ def regroup(parser, token):
if lastbits_reversed[1][::-1] != 'as':
raise TemplateSyntaxError, "next-to-last argument to 'regroup' tag must be 'as'"
- expression = parser.compile_filter('var.%s' % lastbits_reversed[2][::-1])
+ expression = parser.compile_filter(lastbits_reversed[2][::-1])
var_name = lastbits_reversed[0][::-1]
return RegroupNode(target, expression, var_name)
Please sign in to comment.
Something went wrong with that request. Please try again.