make dates work
This commit is contained in:
parent
c43d1053bf
commit
6c148370e7
|
@ -10,6 +10,7 @@ from ox.django.shortcuts import render_to_json_response
|
|||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.paginator import Paginator, InvalidPage, EmptyPage
|
||||
from datetime import datetime
|
||||
#import pdb
|
||||
|
||||
@login_required
|
||||
|
@ -180,7 +181,13 @@ def shipList(request):
|
|||
goods = request.GET.get('goods', '')
|
||||
# country = request.GET.get('country', None)
|
||||
qset = Ship.objects.all()
|
||||
#add dates stuff
|
||||
if startDate != '':
|
||||
start_dt = datetime.strptime(startDate, '%Y-%m-%d')
|
||||
qset = qset.filter(date__gte=start_dt)
|
||||
if endDate != '':
|
||||
end_dt = datetime.strptime(endDate, '%Y-%m-%d')
|
||||
qset = qset.filter(date__lte=end_dt)
|
||||
|
||||
if billType != '':
|
||||
qset = qset.filter(bill_type__iexact=billType)
|
||||
if shipName != '':
|
||||
|
|
|
@ -27,10 +27,13 @@ No of results: {{ no_of_results }} displaying page {{ page }} of {{ no_of
|
|||
</div>
|
||||
<div id="leftCol">
|
||||
<form id="shipFilterForm" action="" method="GET">
|
||||
<!--
|
||||
<input type="date" name="start_date" id="id_start_date" />
|
||||
<input type="date" name="end_date" id="id_end_date" />
|
||||
-->
|
||||
|
||||
<label for="id_start_date">Start Date:</label>
|
||||
<input type="date" name="start_date" id="id_start_date" /> <br />
|
||||
|
||||
<label for="id_end_date">End Date:</label>
|
||||
<input type="date" name="end_date" id="id_end_date" /> <br />
|
||||
|
||||
<label for="id_bill_type">Bill Type:</label>
|
||||
<select name="bill_type" id="id_bill_type">
|
||||
<option value="">-----</option>
|
||||
|
|
Loading…
Reference in New Issue
Block a user