views:

93

answers:

3

I installed Django tiny mce however i am getting a normal text area in my admin. Can anyone help me to correct this to a rich text area where i can acces text formating?

here are my settings.py

 import os
PROJECT_DIR = os.path.dirname(__file__)

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', '[email protected]'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '',                      # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}


TIME_ZONE = 'Europe/London'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-gb'

...
...
...
...    
...    
...    
...    
...    
...    
...    
...    
...    
...    
...
TINYMCE_JS_URL = '/media/js/tiny_mce/tiny_mce.js/'

# languages you want to translate into the CMS.

DEFAULT_PAGE_TEMPLATE = 'pages/generic.html'

PAGE_TEMPLATES = (
    ('pages/generic.html', 'Generic'),
 ('pages/index.html', 'Home Page'),
    ('pages/people.html', 'People'),

)
+1  A: 

django-tinymce doesn't replace all textarea fields with TinyMCE editors, you have to use it explicitely either with HTMLField in your models:

from django.db import models
from tinymce import models as tinymce_models

class MyModel(models.Model):
    my_field = tinymce_models.HTMLField()

Or for third party apps by replacing the widgets in the admin, as explained in the documentation.

Luper Rouch
Cheers, This is correct.
Rick
A: 

use this.. i found it the other day, its a really nice step-by-step tutorial to use tinymce in the django admin

http://code.djangoproject.com/wiki/AddWYSIWYGEditor

pleasedontbelong
A: 

Thanks your answers were very valid, I don't think I articulated my question properly though its my fault I am new to django. I was using tinymce with django page cms placeholders.

The problem was my settings.py it needed to be config in the correct way. small issue...

The application can be configured by editing the project’s settings.py file.

TINYMCE_JS_URL (default: settings.MEDIA_URL + 'js/tiny_mce/tiny_mce.js')
    The URL of the TinyMCE javascript file.
TINYMCE_JS_ROOT (default: settings.MEDIA_ROOT + 'js/tiny_mce')
    The filesystem location of the TinyMCE files.
TINYMCE_DEFAULT_CONFIG (default: {'theme': "simple", 'relative_urls': False})
    The default TinyMCE configuration to use. See the TinyMCE manual for all options. To set the configuration for a specific TinyMCE editor, see the mce_attrs parameter for the widget.
TINYMCE_SPELLCHECKER (default: False)
    Whether to use the spell checker through the supplied view. You must add spellchecker to the TinyMCE plugin list yourself, it is not added automatically.
TINYMCE_COMPRESSOR (default: False)
    Whether to use the TinyMCE compressor, which gzips all Javascript files into a single stream. This makes the overall download size 75% smaller and also reduces the number of requests. The overall initialization time for TinyMCE will be reduced dramatically if you use this option.
TINYMCE_FILEBROWSER (default: True if 'filebrowser' is in INSTALLED_APPS, else False)
    Whether to use django-filebrowser as a custom filebrowser for media inclusion. See the official TinyMCE documentation on custom filebrowsers.

Example:

TINYMCE_JS_URL = 'http://debug.example.org/tiny_mce/tiny_mce_src.js'
TINYMCE_DEFAULT_CONFIG = {
    'plugins': "table,spellchecker,paste,searchreplace",
    'theme': "advanced",
}
TINYMCE_SPELLCHECKER = True
TINYMCE_COMPRESSOR = True

Taken from. http://django-tinymce.googlecode.com/svn/tags/release-1.5/docs/.build/html/installation.html

Rick