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.views.decorators.csrf import csrf_exempt
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.core.paginator import Paginator, InvalidPage, EmptyPage
|
from django.core.paginator import Paginator, InvalidPage, EmptyPage
|
||||||
|
from datetime import datetime
|
||||||
#import pdb
|
#import pdb
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -180,7 +181,13 @@ def shipList(request):
|
||||||
goods = request.GET.get('goods', '')
|
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
|
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 != '':
|
if billType != '':
|
||||||
qset = qset.filter(bill_type__iexact=billType)
|
qset = qset.filter(bill_type__iexact=billType)
|
||||||
if shipName != '':
|
if shipName != '':
|
||||||
|
|
|
@ -27,10 +27,13 @@ No of results: {{ no_of_results }} displaying page {{ page }} of {{ no_of
|
||||||
</div>
|
</div>
|
||||||
<div id="leftCol">
|
<div id="leftCol">
|
||||||
<form id="shipFilterForm" action="" method="GET">
|
<form id="shipFilterForm" action="" method="GET">
|
||||||
<!--
|
|
||||||
<input type="date" name="start_date" id="id_start_date" />
|
<label for="id_start_date">Start Date:</label>
|
||||||
<input type="date" name="end_date" id="id_end_date" />
|
<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>
|
<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="">-----</option>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user