from flask import Flask, render_template from flask.ext.wtf import Form, SubmitField, Field, TextInput app = Flask(__name__) app.config['SECRET_KEY'] = 'Shh!' class CustomField(Field): widget = TextInput() def _value(self): if self.data: return u', '.join(self.data) else: return u'' def process_formdata(self, valuelist): if valuelist: self.data = [x.strip() for x in valuelist[0].split(',')] else: self.data = [] class ExampleForm(Form): status = CustomField() submit = SubmitField('POST')
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter