added queryviews
This commit is contained in:
parent
e16d8941c4
commit
0d7aa2390d
12
manifests/ships/queryviews.py
Normal file
12
manifests/ships/queryviews.py
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
from models import *
|
||||||
|
from django.shortcuts import render_to_response
|
||||||
|
from django.http import HttpResponse
|
||||||
|
|
||||||
|
def uniqueShips(request):
|
||||||
|
ships = Ship.objects.values('ship_name', 'ship_name_trans').distinct('ship_name')
|
||||||
|
return render_to_response("uniqueShips.html", {'ships': ships, 'count': ships.count()})
|
||||||
|
|
||||||
|
|
||||||
|
def uniquePorts(request):
|
||||||
|
ports = Ship.objects.order_by('port').values('port').distinct()
|
||||||
|
return render_to_response("uniquePorts.html", {'ports': ports, 'count': ports.count()})
|
Loading…
Reference in New Issue
Block a user