Z
Z
zedzew2015-03-28 14:01:09
Flask
zedzew, 2015-03-28 14:01:09

How to create a DateTime now form?

How to create a DateTime now form? How to implement what would be automatically added and filled in the form, can it be implemented by Flaskom or is it necessary in Javascript.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Abiduev, 2015-06-27
@gunlinux

http://momentjs.com/
There is a binding for flask
If you have sqlalchemy:

import datetime
class Log(db.Model):
    ...
    date = db.Column(db.DateTime, default=datetime.datetime.now)
    ...

If Flask-wtf
import datetime

@blueprint.route('/add', methods=["POST", "GET"])
def route():
    ...
    form.date.data = datetime.datetime.now()
    if form.validate_on_submit():
        #обрабытваем форму

In any case, I recommend reading the Flask Mega-Tutorial / Flask Web Development

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question