summaryrefslogtreecommitdiffstats
path: root/askbot/forms.py
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-09-09 21:16:16 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-09-09 21:16:16 -0400
commit4e550d5358a512bf543efbf862ed75709b955340 (patch)
treebf37433f15e20dd1252ece9acb69163bac661dc8 /askbot/forms.py
parente5fbb42da5665df017cb98b7cb99d8c8d8d5fe52 (diff)
downloadaskbot-4e550d5358a512bf543efbf862ed75709b955340.tar.gz
askbot-4e550d5358a512bf543efbf862ed75709b955340.tar.bz2
askbot-4e550d5358a512bf543efbf862ed75709b955340.zip
tinymce editor works in the popups too
Diffstat (limited to 'askbot/forms.py')
-rw-r--r--askbot/forms.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/askbot/forms.py b/askbot/forms.py
index 0ed888a5..43993cad 100644
--- a/askbot/forms.py
+++ b/askbot/forms.py
@@ -274,13 +274,14 @@ class EditorField(forms.CharField):
min_length = 10 # sentinel default value
def __init__(self, *args, **kwargs):
+ editor_attrs = kwargs.pop('editor_attrs', {})
super(EditorField, self).__init__(*args, **kwargs)
self.required = True
widget_attrs = {'id': 'editor'}
if askbot_settings.EDITOR_TYPE == 'markdown':
self.widget = forms.Textarea(attrs=widget_attrs)
elif askbot_settings.EDITOR_TYPE == 'tinymce':
- self.widget = TinyMCE(attrs=widget_attrs)
+ self.widget = TinyMCE(attrs=widget_attrs, mce_attrs=editor_attrs)
self.label = _('content')
self.help_text = u''
self.initial = ''
@@ -463,6 +464,17 @@ class SummaryField(forms.CharField):
)
+class EditorForm(forms.Form):
+ """form with one field - `editor`
+ the field must be created dynamically, so it's added
+ in the __init__() function"""
+
+ def __init__(self, editor_attrs=None):
+ super(EditorForm, self).__init__()
+ editor_attrs = editor_attrs or {}
+ self.fields['editor'] = EditorField(editor_attrs=editor_attrs)
+
+
class DumpUploadForm(forms.Form):
"""This form handles importing
data into the forum. At the moment it only