예제 #1
0
def main(request):
    database = DB()
    list = database.getOrderList()
    car = database.getCarList()
    for elem in list:
        print elem
    return render(request, 'main_page.html', {'list': list, 'car': car})
예제 #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
    })