Fixed date vs datetime

This commit is contained in:
Joachim Lusiardi 2016-04-18 20:58:20 +02:00
parent 1998fcb7d8
commit 4c97bd86db
1 changed files with 2 additions and 3 deletions

View File

@ -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)