简体   繁体   English

Django-tinymce 未显示在管理员中

[英]Django-tinymce not showing in admin

I installed django-tinymce, put it in the installed apps, added the url.我安装了 django-tinymce,把它放在安装的应用程序中,添加了 url。 Then I created a model as below:然后我创建了一个 model 如下:

from tinymce import models as tinymce_models

class Post(models.Model):
    parent = models.ForeignKey('self', blank=True, null=True, on_delete=models.CASCADE)
    unit = models.DecimalField(max_digits=20, decimal_places=2)
    title = models.CharField(max_length=200)
    content = tinymce_models.HTMLField()

I have also registered this model into the admin.我还将此 model 注册到管理员中。 When trying to add a Post instance through the admin, all the fields are showing, except for the content field.尝试通过管理员添加Post实例时,所有字段都显示,除了content字段。 That is the field using Tinymce.那就是使用Tinymce的领域。 The field is just white space with no option to input anything.该字段只是空白,没有输入任何内容的选项。 Anybody know a fix?有人知道修复吗?

Give this a shot:试一试:

from tinymce import HTMLField

class Post(models.Model):
    parent = models.ForeignKey('self', blank=True, null=True, on_delete=models.CASCADE)
    unit = models.DecimalField(max_digits=20, decimal_places=2)
    title = models.CharField(max_length=200)
    content = HTMLField()

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

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