def new_ad(): if request.method == 'GET': return render_template('new_ad.html', ads=Ad.all()) elif request.method == 'POST': ad = Ad.find(request.form['ad_id']) values = (None, request.form['title'], request.form['description'], request.form['price'], request.form['date'], request.form['is_active'], request.form['buyer'], ad) Ad(*values).create() return redirect('/')
def get_categories(): return render_template("categories.html", categories=Ad.all())
def list_ads(): return render_template('ads.html', ads=Ad.all())