mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-01 15:54:53 +00:00
22 lines
638 B
Python
22 lines
638 B
Python
from pgweb.util.contexts import render_pgweb
|
|
|
|
from .models import PUG
|
|
|
|
|
|
def index(request):
|
|
"""
|
|
contains list of PUGs, in country/locale alphabetical order
|
|
"""
|
|
pug_list = []
|
|
for pug in PUG.objects.filter(approved=True).order_by('country__name', 'locale').all():
|
|
if pug_list and pug_list[-1].get('country') == pug.country.name:
|
|
pug_list[-1]['pugs'].append(pug)
|
|
else:
|
|
pug_list.append({
|
|
'country': pug.country.name,
|
|
'pugs': [pug]
|
|
})
|
|
return render_pgweb(request, 'community', 'pugs/index.html', {
|
|
'pug_list': pug_list,
|
|
})
|