2010-09-13 15 views
2

J'ai installé Django tiny mce mais je reçois une zone de texte normale dans mon admin. Quelqu'un peut-il m'aider à corriger cela dans une zone de texte riche où je peux accéder au formatage de texte?django tiny mce est un champ de texte normal au lieu d'un formatage de texte enrichi? un correctif s'il vous plaît. Paramètres inclus

voici mon 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. 
    } 
} 



... 
... 
... 
...  
...  
...  
...  
...  
...  
...  
...  
...  
...  
... 
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'), 

) 

Répondre

2

django-tinymce ne remplace pas tous les champs textarea avec les éditeurs TinyMCE, vous devez l'utiliser soit avec HTMLField explicitement dans vos modèles:

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

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

Ou pour les applications tierces en remplaçant les widgets dans l'admin, comme expliqué dans the documentation.

+0

Bravo, c'est correct. – Stu

0

Merci de vos réponses étaient très valables, je ne Je ne pense pas avoir articulé correctement ma question bien que ce soit de ma faute si je suis nouveau dans le django. J'utilisais tinymce avec des espaces réservés django page cms.

Le problème était mon settings.py il devait être config correctement. petit numéro ...

L'application peut être configurée en éditant le fichier settings.py du projet.

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 

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