Skip to content

Instantly share code, notes, and snippets.

@datousir
Forked from doobeh/vort.html
Created July 25, 2017 14:36
Show Gist options
  • Save datousir/d5f45e8d1818bebb3e8d8973b1340d8c to your computer and use it in GitHub Desktop.
Save datousir/d5f45e8d1818bebb3e8d8973b1340d8c to your computer and use it in GitHub Desktop.

Revisions

  1. @doobeh doobeh created this gist Mar 2, 2016.
    27 changes: 27 additions & 0 deletions vort.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>DatePicker Example</title>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
    <script>
    $(function() {
    $( ".dtpick" ).datepicker();
    });
    </script>
    </head>
    <body>


    <form method="post" action="">
    {{ form.hidden_tag() }}
    {{ form.dt(class="dtpick") }}
    <button type="submit">Go</button>
    </form>


    </body>
    </html>
    22 changes: 22 additions & 0 deletions vort.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    from flask import Flask, render_template
    from flask_wtf import Form
    from wtforms import DateField
    from datetime import date

    app = Flask(__name__)
    app.secret_key = 'SHH!'


    class DateForm(Form):
    dt = DateField('Pick a Date', format="%m/%d/%Y")


    @app.route('/', methods=['post','get'])
    def home():
    form = DateForm()
    if form.validate_on_submit():
    return form.dt.data.strftime('%x')
    return render_template('vort.html', form=form)

    if __name__ == '__main__':
    app.run(debug=True)