mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-13 13:12:42 +00:00
36 lines
993 B
Python
36 lines
993 B
Python
from django.shortcuts import render_to_response, get_object_or_404
|
|
from django.http import HttpResponseRedirect, HttpResponse, Http404
|
|
|
|
from pgweb.util.contexts import NavContext
|
|
|
|
from models import *
|
|
|
|
def root(request):
|
|
features = Feature.objects.all().select_related().order_by('group__groupsort', 'group__groupname', 'featurename')
|
|
groups = []
|
|
lastgroup = -1
|
|
currentgroup = None
|
|
for f in features:
|
|
if f.group.id != lastgroup:
|
|
if currentgroup:
|
|
groups.append(currentgroup)
|
|
lastgroup = f.group.id
|
|
currentgroup = {
|
|
'group': f.group,
|
|
'features': [],
|
|
}
|
|
currentgroup['features'].append(f)
|
|
if currentgroup:
|
|
groups.append(currentgroup)
|
|
|
|
return render_to_response('featurematrix/featurematrix.html', {
|
|
'groups': groups,
|
|
}, NavContext(request, 'about'))
|
|
|
|
def detail(request, featureid):
|
|
feature = get_object_or_404(Feature, pk=featureid)
|
|
return render_to_response('featurematrix/featuredetail.html', {
|
|
'feature': feature,
|
|
}, NavContext(request, 'about'))
|
|
|