form handling

This commit is contained in:
Sanj 2012-04-22 16:37:35 +05:30
parent 2684fd906c
commit c43d1053bf
2 changed files with 18 additions and 17 deletions

View File

@ -169,31 +169,31 @@ def stringtranslate(request):
def shipList(request): def shipList(request):
page = request.GET.get('page', 1) page = request.GET.get('page', 1)
page_size = request.GET.get('page_size', 50) page_size = request.GET.get('page_size', 50)
startDate = request.GET.get('start_date', None) startDate = request.GET.get('start_date', '')
endDate = request.GET.get('end_date', None) endDate = request.GET.get('end_date', '')
billType = request.GET.get('bill_type', None) billType = request.GET.get('bill_type', '')
shipName = request.GET.get('ship_name', None) shipName = request.GET.get('ship_name', '')
captain = request.GET.get('captain', None) captain = request.GET.get('captain', '')
flag = request.GET.get('flag', None) flag = request.GET.get('flag', '')
owner = request.GET.get('owner', None) owner = request.GET.get('owner', '')
port = request.GET.get('port', None) port = request.GET.get('port', '')
goods = request.GET.get('goods', None) goods = request.GET.get('goods', '')
# country = request.GET.get('country', None) # country = request.GET.get('country', None)
qset = Ship.objects.all() qset = Ship.objects.all()
#add dates stuff #add dates stuff
if billType: if billType != '':
qset = qset.filter(billType__iexact=billType) qset = qset.filter(bill_type__iexact=billType)
if shipName: if shipName != '':
qset = qset.filter(ship_name_trans__icontains=shipName) qset = qset.filter(ship_name_trans__icontains=shipName)
if captain: if captain != '':
qset = qset.filter(captain_trans__icontains=captain) qset = qset.filter(captain_trans__icontains=captain)
if flag: if flag != '':
qset = qset.filter(flag__iexact=flag) qset = qset.filter(flag__iexact=flag)
if owner: if owner != '':
qset = qset.filter(owner_trans__icontains=owner) qset = qset.filter(owner_trans__icontains=owner)
if port: if port != '':
qset = qset.filter(port__icontains=port) qset = qset.filter(port__icontains=port)
if goods: if goods != '':
qset = qset.filter(good__description_string_trans__icontains=goods).distinct() qset = qset.filter(good__description_string_trans__icontains=goods).distinct()
# if country: # if country:
# qset = qset.filter(country__icontains=country) # qset = qset.filter(country__icontains=country)

View File

@ -33,6 +33,7 @@ No of results: {{ no_of_results }}   displaying page {{ page }} of {{ no_of
--> -->
<label for="id_bill_type">Bill Type:</label> <label for="id_bill_type">Bill Type:</label>
<select name="bill_type" id="id_bill_type"> <select name="bill_type" id="id_bill_type">
<option value="">-----</option>
<option value="Import">Import</option> <option value="Import">Import</option>
<option value="Export">Export</option> <option value="Export">Export</option>
<option value="Rexport">Rexport</option> <option value="Rexport">Rexport</option>