From 4c97bd86db0c7aae7aff1f02bfae0d8a8b056d81 Mon Sep 17 00:00:00 2001 From: Joachim Lusiardi Date: Mon, 18 Apr 2016 20:58:20 +0200 Subject: [PATCH] Fixed date vs datetime --- app/main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/main.py b/app/main.py index 88a435f..2ed0409 100644 --- a/app/main.py +++ b/app/main.py @@ -139,12 +139,11 @@ class CreatePitstopForm(Form): def create_pit_stop_form(): last_pitstop = Pitstop.query.order_by(Pitstop.id.desc()).first() if last_pitstop is None: - last_pitstop = Pitstop(0, 0, datetime.now()) + last_pitstop = Pitstop(0, 0, date.today()) form = CreatePitstopForm() form.set_pitstop(last_pitstop) if form.validate_on_submit(): - new_stop = Pitstop(form.odometer.data, form.litres.data, form.date.data) sqldb.session.add(new_stop) sqldb.session.commit() @@ -153,7 +152,7 @@ def create_pit_stop_form(): # dynamically set values form.odometer.default = last_pitstop.odometer form.litres.default = last_pitstop.litres - form.date.default = datetime.now() + form.date.default = date.today() form.process() return render_template('newPitStopForm.html', form=form)