-
-
Save datousir/d5f45e8d1818bebb3e8d8973b1340d8c to your computer and use it in GitHub Desktop.
Revisions
-
doobeh created this gist
Mar 2, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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)