Monday, September 13, 2010

Re: django tinyMCE is normal text field instead of rich text formatting? a fix please.

Hi,

What does your admin.py look like?

You might need to add a media class to your admin classes e.g.

class Media:
js = ('/js/tiny_mce/tiny_mce.js', '/js/textareas.js')

I never tried to get tinymce working with the admin mind, I just
spotted it in the below tutorial:

http://luishenrique.org/blog/posts/editor-tinymce-no-django-admin

Regards,

John

On Sep 13, 5:57 pm, "tricks...@googlemail.com" <p...@hotmail.co.uk>
wrote:
> 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 access text formatting?
>
> Any help would be greatly appreciated. Here are my settings.py........
>
> import os
> PROJECT_DIR = os.path.dirname(__file__)
>
> DEBUG = True
> TEMPLATE_DEBUG = DEBUG
>
> ADMINS = (
>     # ('Your Name', 'your_em...@domain.com'),
> )
>
> 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'
>
> PAGE_USE_SITE_ID = False
>
> SITE_ID = 1
>
> # If you set this to False, Django will make some optimizations so as
> not
> # to load the internationalization machinery.
> USE_I18N = True
>
> # If you set this to False, Django will not format dates, numbers and
> # calendars according to the current locale
> USE_L10N = True
>
> # Absolute path to the directory that holds media.
> # Example: "/home/media/media.lawrence.com/"
>
> MEDIA_ROOT = STATIC_ROOT = os.path.join(PROJECT_DIR, 'media')
> MEDIA_URL = STATIC_URL = '/media/'
> ADMIN_MEDIA_PREFIX = '/admin_media/'
> # URL prefix for admin media -- CSS, JavaScript and images. Make sure
> to use a
> # trailing slash.
> # Examples: "http://foo.com/media/", "/media/".
> ADMIN_MEDIA_ROOT = os.path.join(STATIC_ROOT, 'admin_media')
> ADMIN_MEDIA_PREFIX = '/admin_media/'
>
> FIXTURE_DIRS = [os.path.join(PROJECT_DIR, 'fixtures')]
>
> # Make this unique, and don't share it with anybody.
>
> # List of callables that know how to import templates from various
> sources.
> TEMPLATE_LOADERS = (
>     'django.template.loaders.filesystem.Loader',
>     'django.template.loaders.app_directories.Loader',
>      'django.template.loaders.eggs.Loader',
>
> )
>
> TEMPLATE_CONTEXT_PROCESSORS = (
>     'django.core.context_processors.auth',
>     'django.core.context_processors.i18n',
>     'django.core.context_processors.debug',
>     'django.core.context_processors.media',
>     'django.core.context_processors.request',
>     'pages.context_processors.media',
>
> )
>
> MIDDLEWARE_CLASSES = (
>     'django.middleware.common.CommonMiddleware',
>     'django.contrib.sessions.middleware.SessionMiddleware',
>     'django.middleware.csrf.CsrfViewMiddleware',
>     'django.contrib.auth.middleware.AuthenticationMiddleware',
>     'django.contrib.messages.middleware.MessageMiddleware',
> )
>
> CACHE_BACKEND = "locmem:///?timeout=300&max_entries=5000"
> INTERNAL_IPS = ('127.0.0.1:8000',)
> ROOT_URLCONF = 'project.urls'
>
> TEMPLATE_DIRS = (
>     os.path.join(PROJECT_DIR, 'templates'),
> )
>
> INSTALLED_APPS = (
>     'django.contrib.auth',
>     'django.contrib.contenttypes',
>     'django.contrib.sessions',
>     'django.contrib.sites',
>     'django.contrib.messages',
>  'mptt',
>     'django.contrib.admin',
>  'pages',
>  'news',
>  'tinymce',
>  'staticfiles'
> )
>
> gettext_noop = lambda s: s
> PAGE_LANGUAGES = (
>     ('en-gb', gettext_noop('UK English')),
> )
> PAGE_TINYMCE = True
> LANGUAGE_CODE = 'en-gb'
> LANGUAGES = list(PAGE_LANGUAGES)
> # Page CMS
>
> PAGE_TINYMCE = True
> TINYMCE_FILEBROWSER = False
> PAGE_TAGGING = False
> #PAGE_PERMISSION = False
> #PAGE_CONTENT_REVISION = False
> PAGE_HIDE_ROOT_SLUG = True
> PAGE_SANITIZE_USER_INPUT = True
> PAGE_USE_SITE_ID = False
>
> 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'),
>
> )

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment