Created
March 2, 2016 19:40
-
-
Save doobeh/3e685ef25fac7d03ded7 to your computer and use it in GitHub Desktop.
DatePicker JS Example Flask
This file contains 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 characters
<!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 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 characters
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) |
Is this something doable/embed on bokeh server?
how to do year/month/date
@doobeh how to do year/month/date
nice!
Nice thxxx
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank!