Beispiel #1
0
def search_price():
    """
    Запрос автомобилей, удовлетворяющих определенной цене
    """
    form = SearchPriceForm()
    if form.validate_on_submit():
        # получить все машины по определенной цене
        cars = CarsModel(db.get_connection()).get_by_price(form.start_price.data, form.end_price.data)
        # редирект на страницу с результатами
        return render_template('car_user.html', username=session['username'], title='Просмотр базы', cars=cars)
    return render_template("search_price.html", title='Подбор по цене', form=form)
Beispiel #2
0
def search_price():
    form = SearchPriceForm()
    if form.validate_on_submit():
        motorcycles = MotorcycleModel(db.get_connection()).get_by_price(
            form.start_price.data, form.end_price.data)
        return render_template('motorcycle_user.html',
                               username=session['username'],
                               title='View database',
                               motorcycles=motorcycles)
    return render_template("search_price.html",
                           title='Pricing by price',
                           form=form)
Beispiel #3
0
def search_price():
    form = SearchPriceForm()
    if form.validate_on_submit():
        cars = CarsModel(db.get_connection()).get_by_price(
            form.start_price.data, form.end_price.data)
        return render_template('car_user.html',
                               username=session['username'],
                               title='Просмотр базы',
                               cars=cars)
    return render_template("search_price.html",
                           title='Подбор по цене',
                           form=form)
Beispiel #4
0
def search_price():
    # Страница пользователя с сортировкой по цене
    form = SearchPriceForm()
    if form.validate_on_submit():
        fruits = FruitModel(db.get_connection()).get_by_price(
            form.start_price.data, form.end_price.data)
        return render_template('fruits_for_user.html',
                               username=session['username'],
                               title='Просмотр базы',
                               fruits=fruits)
    return render_template("search_price.html",
                           title='Подбор по цене',
                           form=form)
Beispiel #5
0
def search_price():
    # Запрос книг, удовлетворяющих определенной цене
    form = SearchPriceForm()
    if form.validate_on_submit():
        # получить все книги по определенной цене
        books = Book(db.get_connection()).get_by_price(form.start_price.data,
                                                       form.end_price.data)
        # редирект на страницу с результатами
        books = sorted(books, key=lambda x: x[1])
        return render_template('book_user.html',
                               username=session['username'],
                               title='Просмотр базы',
                               books=books)
    return render_template("search_price.html",
                           title='Подбор по цене',
                           form=form)