3

Django tiny mce をインストールしましたが、管理画面に通常のテキスト領域が表示されます。これをテキスト書式設定にアクセスできるリッチテキスト領域に修正するのを手伝ってくれる人はいますか?

ここに私のsettings.pyがあります

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

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', 'your_email@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.
    }
}



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

)
4

3 に答える 3

3

django-tinymce は、すべての textarea フィールドを TinyMCE エディターに置き換えるわけではありませんHTMLField。モデルで次のいずれかを明示的に使用する必要があります。

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

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

または、ドキュメントで説明されているように、管理者のウィジェットを置き換えることにより、サードパーティのアプリの場合。

于 2010-09-13T17:05:21.853 に答える
0

これを使用してください..先日見つけました.django管理者でtinymceを使用するための本当に素晴らしいステップバイステップのチュートリアルです

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

于 2010-09-13T17:56:12.130 に答える
0

あなたの答えが非常に有効であったことに感謝します.djangoを初めて使用するのは私のせいですが、質問を適切に表現したとは思いません. 私はdjango page cmsプレースホルダーでtinymceを使用していました。

問題は私のsettings.pyで、正しい方法で設定する必要がありました。小さな問題...

アプリケーションは、プロジェクトの settings.py ファイルを編集することで構成できます。

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

から撮影。 http://django-tinymce.googlecode.com/svn/tags/release-1.5/docs/.build/html/installation.html

于 2010-09-23T08:11:17.177 に答える