0

我在我的 django 应用程序中使用 django-wysiwyg,默认情况下它使用 YUI 的编辑器。我宁愿它使用 SimpleEditor,因为它更简单。

有没有一种不需要分叉项目的简单方法?:)

4

2 回答 2

0

您总是可以Media在文件的适当类中定义一个类,admin.py其中包括支持 WYSIWYG 编辑器的 Javascript。

from django.contrib import admin
from models import MyModel

class MyModelAdmin(admin.ModelAdmin):
    class Media:
         js = [
              '/path/to/static/js/that/includes/wysiwyg.js',
              '/path/to/static/js/that/replaces/textarea/with/wysiwyg.js',
         ]

admin.site.register(MyModel, MyModelAdmin)
于 2011-05-30T09:59:46.280 回答
0

我最终django_wysiwyg在我的模板目录下创建了一个目录,并在其下放置:

- simple_yui
    - includes.html
    - editor_instance.html

Whereeditor_instance.html只是扩展了默认的,并且includes.html是默认的副本,SimpleEditor而不是Editor. 然后我只需要添加到我的设置中:

DJANGO_WYSIWYG_FLAVOR = 'simple_yui'

那是什么。不是很干净,但成功了

于 2011-06-01T06:19:37.243 回答