Commit 42966a79 authored by Paul Brown's avatar Paul Brown

Merge pull request #927 from pawl/fix_WYSIWYG

fix WYSIWYG example for bootstrap3
parents a6d6b3e4 2918eee5
...@@ -18,10 +18,16 @@ app.config['SQLALCHEMY_ECHO'] = True ...@@ -18,10 +18,16 @@ app.config['SQLALCHEMY_ECHO'] = True
db = SQLAlchemy(app) db = SQLAlchemy(app)
# Define wtforms widget and field ''' Define a wtforms widget and field.
WTForms documentation on custom widgets:
http://wtforms.readthedocs.org/en/latest/widgets.html#custom-widgets
'''
class CKTextAreaWidget(widgets.TextArea): class CKTextAreaWidget(widgets.TextArea):
def __call__(self, field, **kwargs): def __call__(self, field, **kwargs):
kwargs.setdefault('class_', 'ckeditor') # add WYSIWYG class to existing classes
existing_classes = kwargs.pop('class', '') or kwargs.pop('class_', '')
kwargs['class'] = u'%s %s' % (existing_classes, "ckeditor")
return super(CKTextAreaWidget, self).__call__(field, **kwargs) return super(CKTextAreaWidget, self).__call__(field, **kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment