Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 authored May 31, 2007

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  django/template/defaulttags.py
4  django/template/defaulttags.py
@@ -237,7 +237,7 @@ def render(self, context):
237 237
             return ''
238 238
         output = [] # list of dictionaries in the format {'grouper': 'key', 'list': [list of contents]}
239 239
         for obj in obj_list:
240  
-            grouper = self.expression.resolve(Context({'var': obj}), True)
  240
+            grouper = self.expression.resolve(obj, True)
241 241
             # TODO: Is this a sensible way to determine equality?
242 242
             if output and repr(output[-1]['grouper']) == repr(grouper):
243 243
                 output[-1]['list'].append(obj)
@@ -847,7 +847,7 @@ def regroup(parser, token):
847 847
     if lastbits_reversed[1][::-1] != 'as':
848 848
         raise TemplateSyntaxError, "next-to-last argument to 'regroup' tag must be 'as'"
849 849
 
850  
-    expression = parser.compile_filter('var.%s' % lastbits_reversed[2][::-1])
  850
+    expression = parser.compile_filter(lastbits_reversed[2][::-1])
851 851
 
852 852
     var_name = lastbits_reversed[0][::-1]
853 853
     return RegroupNode(target, expression, var_name)

0 notes on commit 603d5cc

Please sign in to comment.
Something went wrong with that request. Please try again.