I am trying to get this package to work in Django: https://github.com/romanvm/django-tinymce4-lite
I'm using docker compose for my django installation. The setup is identical to this one here: https://docs.docker.com/compose/django/
Earlier when I encountered similar errors it had to do with the pip package not being properly loaded in docker. Now, I have loaded the "django-tinymce4-lite" package as follows:
- I have edited my requirements.txt in my project
- I have rebuilt my docker image
When I log onto the docker instance, I can check the presence of the package using this:
$ pip freeze Django==2.0.6 django-bootstrap3==10.0.1 django-tinymce4-lite==1.7.1 jsmin==2.2.2 Pillow==5.1.0 psycopg2-binary==2.7.4 pytz==2018.4
This seems to be in line with my requirements.txt file:
Django>=2.0
psycopg2-binary
django-bootstrap3
django-tinymce4-lite
Pillow
However, when I follow the instructions I do this:
Add tinymce to INSTALLED_APPS in settings.py for your Django project
INSTALLED_APPS = ( ... 'tinymce', )
Add tinymce.urls to urls.py for your project:
urlpatterns = [ ... url(r'^tinymce/', include('tinymce.urls')), ... ]
NOTE: because I use Django 2 I have had to rewrite this. Here is what I use:
path('tinymce/', include('tinymce.urls')),
I have tried this both in my main project urls.py as well as in my app urls.py. The next step is:
In your code:
from django.db import models
from tinymce import HTMLField
class MyModel(models.Model):
...
content = HTMLField('Content')
However, the moment that I do this, I get this error:
AttributeError: module 'django.db.models' has no attribute 'HTMLField'
Anybody any idea how I could further debug/investigate this?
models.HTMLFieldsomewhere; and try deleting any*.pycfiles. - Burhan Khalidmodels.HTMLFieldinstead of HTMLField (without the models.!). Could you add this as an answer to confirm it? - user585936