Exemplo n.º 1
0
def listView(request):
    database = DB()

    if 'fromAge' in request.GET and 'toAge' in request.GET:
        list = database.getSalesListByAge(int(request.GET['fromAge']), int(request.GET['toAge']))

    elif 'departmentId' in request.GET:
        list = database.getSalesListByDepartmentID(int(request.GET['departmentId']))
    elif 'excludeWord' in request.GET:
        list = database.getListExcluded(request.GET['excludeWord'])
    elif 'containsString' in request.GET:
        list = database.getListExcluded(request.GET['containsString'])
    else:
        list = database.getSalesList()
    departments = database.getDepartments()
    return render(request,'listpage.html',{'list':list, 'departments':departments})
Exemplo n.º 2
0
def main(request):
    database = DB()
    msgs = []
    if 'fromLength' in request.GET and 'toLength' in request.GET \
            and request.GET['fromLength'] != '' and request.GET['toLength'] != '':
        list = database.getOrderListByLength(int(request.GET['fromLength']),
                                             int(request.GET['toLength']))
        msgs.append('by travel length')
    elif 'car_id' in request.GET and request.GET['car_id'] != '0':
        list = database.getOrderListByDriverID(int(request.GET['car_id']))
        msgs.append('by driver name')
    elif 'excludeWord' in request.GET and request.GET['excludeWord'] != '':
        list = database.getListExcluded(request.GET['excludeWord'])
        msgs.append('without : ' + request.GET['excludeWord'])
    elif 'includeWord' in request.GET and request.GET['includeWord'] != '':
        list = database.getListIncluded(request.GET['includeWord'])
        msgs.append('with : ' + request.GET['includeWord'])
    else:
        list = database.getOrderList()
    car = database.getCarList()
    return render(request, 'main_page.html', {
        'msgs': msgs,
        'list': list,
        'car': car
    })