简体   繁体   English

如何在django-tinymce HTMLField中增加编辑器的宽度?

[英]How to increase width of editor in django-tinymce HTMLField?

models.py: models.py:

..
from tinymce.models import HTMLField

class MyModel(models.Model):
   ..
   description = HTMLField()
   ..

admin.py 管理员

..
from .models import MyModel
..


class MyModelAdmin(admin.ModelAdmin):

      fieldsets = (
          (None, {
              'fields': (.., 'description', ..,)
          }),
          ..
      ..

How to increase the width of the TinyMCE HTML Editor that appears in the default django admin model add template? 如何增加默认django管理模型添加模板中出现的TinyMCE HTML编辑器的宽度? . Please note that I'm using HTMLField() in model and I don't want to create a Form using forms.py 请注意,我在模型中使用HTMLField(),但我不想使用Forms.py创建一个Form。

Please let me know if you need anymore details. 如果您需要更多详细信息,请告诉我。

Thanks in advance, 提前致谢,

Pavan 帕万

HTMLField is using TinyMCE widget, so you can just customize its number of cols this way: HTMLField正在使用TinyMCE小部件,因此您可以通过以下方式自定义其cols数量:

from tinymce.models import HTMLField
from tinymce.widgets import TinyMCE

class MyModel(models.Model):
   ...
   description = HTMLField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
   ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM