Problem implementing TinyMCE in Django, any help?

Im is working on a web application with Django, and Im is using the Flatpages application.

Now I'm trying to embed the TinyMCE WYSIWYG editor in Flatpages. Im following the steps mentioned in the book Apress: Django Practical Designs. And I did everything right, but the TinyMCE application did not appear in the browser. When I asked the Django IRC channel, we found out that the problem is not in Django, the problem seems to be related to TinyMCE itself. When I tried to find the documentation on the TinyMCE website, everything I found was either very outdated or completely unrelated to my problem. Any tips on how to do this?

+4
source share
6 answers

Have you tried django-tinymce ?

+5
source

I had a django application, but it dropped it in favor: http://code.djangoproject.com/wiki/AddWYSIWYGEditor

The instructions were simple and easy to use - especially the page bit.

The only real problem I encountered is setting MEDIA_URL as a relative value. Until I did this - all my popups are for links and html, etc. Were empty!

+4
source

Author James Bennett delivered the source code for the second edition of the book so you can either check your code, or simply download and use its code.

However, there are two specific questions that you need to answer before further assistance:

  • what version of the book? (The second edition covers Django 1.1, i.e. from the trunk)

  • What version of Django are you using?

  • what version of python do you have ( python -V )?

If you use the second edition and have svn'd Django from the trunk, I can help - everything works fine for me. Here's my (OS X) setup (only for working through the Second Edition of the book with Django from the trunk):

in settings.py :

 TEMPLATE_DIRS = ( '/Users/[myhome]/Sites/django-templates/cms/', ) 

in urls.py:

 (r'^tiny_mce/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': '/Users/[myhome]/djangocode/cms/jscripts/tiny_mce/' }), 

Then a copy of change_form.html duplicated from the django directory and copied to:

 /django-templates/cms/admin/flatpages/flatpage/ 

which includes:

 {{ media }} <script type="text/javascript" src="/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ mode: "textareas", theme: "simple" //or use advanced }); </script> {% endblock %} 

Take a look at this and let us know how you deal!

+3
source

I personally followed the practical book of Django projects. I received the built-in TinyMCE a few days ago. I can help, but I need a little more information. Show me the line on the template where you include the TinyMCE javascript file. Also indicate where you placed the TinyMCE folder. I am sure your problem is that the include script link does not match the actual directory location.

+1
source

A useful first check with JavaScript problems is to make sure all scripts are loaded. Take a look at the HTML source of the generated page in the browser, find all the <script src="..."> tags and make sure their paths are accessible.

You can also see the terminal on which the Django development server is running, or the "Net" Firebug tab.

+1
source

You can view the change_form.html code, which is in my / [template path] / [project name] / admin / flatpages / flatpage /, and it works like a charm: http://pastebin.com/f21a1cd97

0
source

All Articles