page bug again

This commit is contained in:
Sanj 2012-04-22 20:17:05 +05:30
parent c7b8888fb1
commit 8bab4817bb

View File

@ -168,8 +168,8 @@ def stringtranslate(request):
@login_required @login_required
def shipList(request): def shipList(request):
page = int(request.GET.get('page', 1)) page = request.GET.get('page', '')
page_size = int(request.GET.get('page_size', 50)) page_size = request.GET.get('page_size', '')
startDate = request.GET.get('start_date', '') startDate = request.GET.get('start_date', '')
endDate = request.GET.get('end_date', '') endDate = request.GET.get('end_date', '')
billType = request.GET.get('bill_type', '') billType = request.GET.get('bill_type', '')
@ -182,6 +182,10 @@ def shipList(request):
sort = request.GET.get('sort', 'date') sort = request.GET.get('sort', 'date')
# country = request.GET.get('country', None) # country = request.GET.get('country', None)
qset = Ship.objects.all() qset = Ship.objects.all()
if page == '':
page = 1
if page_size == '':
page_size = 50
if startDate != '': if startDate != '':
start_dt = datetime.strptime(startDate, '%Y-%m-%d') start_dt = datetime.strptime(startDate, '%Y-%m-%d')
qset = qset.filter(date__gte=start_dt) qset = qset.filter(date__gte=start_dt)