Search code examples
djangoblogsdjango-1.8django-tinymce

django-tinymce plugins not loading django 1.8


I'm trying to implement django-tinymce in my project. I'd love to use some rich text capability when writing my blog posts, so I'm aiming at applying the HTMLField to the body in the admin.

The settings that I am currently using are really simple - this is what I have in settings.py:

TINYMCE_DEFAULT_CONFIG = {
'theme': "advanced",
'plugins': "wordcount,preview,emotions,", //only wordcount seems to have any effect
'height': "400px",
'width': "700px",

}

this is in the models.py:

from tinymce import models as tinymce_models
...
body = tinymce_models.HTMLField()

and I call the .js in the heads like so:

<script type="text/javascript" src="{% static "tiny_mce/tiny_mce.js" %}"></script>

My issue - no matter what I do in the settings, I get the same result:

Here is what I got

I would appreciate any pointers to what I might be doing wrong.

Thanks a bunch!

Deyan


Solution

  • So, after banging my head for a few days, this is what I finally achieved.

    settings.py

    # tinymce
    TINYMCE_DEFAULT_CONFIG = {
        'theme': "advanced",
        'plugins': "wordcount,preview,emotions,preview,spellchecker,",
        'height': "400px",
        'width': "700px",
        'theme_advanced_buttons3' : "fontselect,fontsizeselect,emotions,preview,",
        }
    

    models.py

    from tinymce.models import HTMLField
    ...
    
        body = HTMLField()
    

    result:

    enter image description here

    As you can see, smilies are smiling beautifully, I've got control over font family and size, it's looking really ugly, but it works and this is the price you pay for hacking stuff I suppose. But it works!

    I found this list of plugins and buttons really helpful - what I wasn't getting before was that the plugins you only load into your django app, but in order to use them, you need to call their buttons. Really straightforward once you get it, but there you go.

    Thanks!