1

I have been reading this installation guide to install tinymce with django. First, it has not worked and second, it seems to be linked only with the admin account. Moreover other blogs about tinymce and django integration are also oriented towards admin account only.

I am basically making a blog application and I want to provide some of the basic features of tinymce and not the whole stuff. What should I do? Should I switch over to some other text editor.

Jeromy French
  • 11,812
  • 19
  • 76
  • 129
Sachin
  • 3,672
  • 9
  • 55
  • 96

3 Answers3

3

i would suggest not doing anything at all on the server-side, include the JS files and use the normal JS-init for creating the widgets.

krs
  • 4,096
  • 19
  • 22
  • Yes thanks I have done exactly that now.... But what about spellchecker? Since natively TinyMCE suggests a php spellchecker and as of now I have only python support so how can I link python based spellchecker such as pyEnchant [1] ?? [1] http://packages.python.org/pyenchant/ – Sachin Dec 11 '11 at 04:23
2

Try it:

class MyForm(forms.Form):

    def __init__(self, *args, **kwargs):
        super(MyForm, self).__init__(+args, **kwargs)
        self.fields['FIELD_NAME'].widget = TinyMCE()
Goin
  • 3,856
  • 26
  • 44
  • For this to work I just need to install the TinyMCE application? Right now I have installed the app and added in the sttings.py file I have also added the js files into my static directory. under the directory structure /static/js/tiny_mce Do I need to do anything else – Sachin Dec 10 '11 at 17:59
  • I think so, but the instalation has a test page https://github.com/aljosa/django-tinymce/blob/master/docs/installation.rst – Goin Dec 10 '11 at 18:02
1

As mentioned in the docs you have to specify the widget in your form class:

from tinymce.widgets import TinyMCE

class MyForm(ModelForm):
    html = forms.CharField(widget=TinyMCE())
arie
  • 18,737
  • 5
  • 70
  • 76
  • This is the same that my answer, I think so – Goin Dec 10 '11 at 18:06
  • Both should work, yes. Though i think specifying the widget directly in the field definition is a bit more intuitive. Also this is the method documemted in django-tinymce's docs. – arie Dec 10 '11 at 18:11