Django-tinymce not showing in admin

105 Views Asked by At

I installed django-tinymce, put it in the installed apps, added the url. Then I created a model as below:

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. When trying to add a Post instance through the admin, all the fields are showing, except for the content field. That is the field using Tinymce. The field is just white space with no option to input anything. Anybody know a fix?

1

There are 1 best solutions below

1
JSRB On

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()