Proper appending of pug list
authorJonathan S. Katz <jonathan.katz@excoventures.com>
Wed, 8 May 2013 20:37:06 +0000 (16:37 -0400)
committerJonathan S. Katz <jonathan.katz@excoventures.com>
Wed, 8 May 2013 20:37:06 +0000 (16:37 -0400)
pgweb/pugs/views.py

index 1d4e5945096d6393d48418eddad5ad2d78d38b22..47bd6cae6dd02986a4cbf2d185fe651527dde771 100644 (file)
@@ -12,11 +12,11 @@ def index(request):
        pug_list = []
        for pug in PUG.objects.filter(approved=True).order_by('country__name', 'title').all():
                if pug_list and pug_list[-1].get('country') == pug.country.name:
-                       pug_list['pugs'].append(pug)
+                       pug_list[-1]['pugs'].append(pug)
                else:
                        pug_list.append({
-                       'country': pug.country.name,
-                       'pugs': [pug]
+                               'country': pug.country.name,
+                               'pugs': [pug]
                        })
        return render_to_response('pugs/index.html', {
                'pug_list': pug_list,