def add_bike(): if request.method == "GET": return render_template("add_bike.html") if request.method == "POST": form = request.form bikename = form["bikename"] hangxe = form["hangxe"] image = form["image"] dongco = form["dongco"] maluc = form["maluc"] hopso = form["hopso"] chieucaoyenxe = form["chieucaoyenxe"] dacdiemkhac = form["dacdiemkhac"] giaxe = form["giaxe"] superbike = Bike(bikename=bikename, hangxe=hangxe, image=image, dongco=dongco, maluc=maluc, hopso=hopso, chieucaoyenxe=chieucaoyenxe, dacdiemkhac=dacdiemkhac, giaxe=giaxe) superbike.save() return render_template("add_bike.html")
def thongso(brand, name): if request.method == "GET": info = Bike.objects(bikename=name) return render_template("thongso.html", hangxe=brand, dongxe=name, info=info) if request.method == "POST": return render_template("homepage.html")
def search(search_name): print(search_name) bikes = Bike.objects(hangxe__icontains=search_name) print(bikes) return redirect("<brand>/<search_name>")
def phankhuc(brand): if request.method == "GET": bikes = Bike.objects(hangxe=brand) return render_template("phankhuc.html", hangxe=brand, bikes=bikes) if request.method == "POST": return render_template("homepage.html")
def thongso(brand,name): info = Bike.objects(bikename=name) return render_template("thongso.html", hangxe = brand, dongxe = name, info = info)
def phankhuc(brand): bikes = Bike.objects(hangxe=brand) return render_template("phankhuc.html",hangxe=brand, bikes = bikes)