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 | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from flask.ext.wtf import Form | |
from flask.ext.babel import gettext | |
from wtforms import SelectField, TelField, TextField, FormField, Fieldlist, SubmitField | |
from wtforms.validators import Optional, Required | |
app = Flask(__name__) | |
db = SQLAlchemy(app) |
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
{% macro form_field(form, field, print_status=True) -%} | |
{% set has_label = kwargs.pop('has_label', True) %} | |
{% set placeholder = '' %} | |
{% if not has_label %} | |
{% set placeholder = field.label.text %} | |
{% endif %} | |
{% set field_status = '' %} | |
{% if form.errors and (form.submitted or (form.is_submitted() and form.submit.data)) %} | |
{# form.submit.data for support multiple forms on page #} | |
{# form.submitted - manual control for form without button (ajax) #} |