1

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?

iscream
  • 680
  • 2
  • 8
  • 20

1 Answers1

0

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()
JSRB
  • 2,492
  • 1
  • 17
  • 48
  • `ImportError: cannot import name 'HTMLField' from 'tinymce' (E:\full-stack projects\django-boilerplate\env\lib\site-packages\tinymce\__init__.py)` – iscream Jun 01 '20 at 17:08