From: Jonathan S. Katz Date: Wed, 8 May 2013 20:37:06 +0000 (-0400) Subject: Proper appending of pug list X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=b52ed662b2187b1367ae71b18775b168878d1772;p=pgweb.git Proper appending of pug list --- diff --git a/pgweb/pugs/views.py b/pgweb/pugs/views.py index 1d4e5945..47bd6cae 100644 --- a/pgweb/pugs/views.py +++ b/pgweb/pugs/views.py @@ -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,