Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with django-ckeditor-5 (support of the 'CKEditor5Field' field type) #576

Open
mikeromanov opened this issue Nov 29, 2020 · 2 comments

Comments

@mikeromanov
Copy link

Hello! My website uses django-modeltranslation to support different languages. Also I want to use django-ckeditor-5 for generate rich text content. However, on trying to attach django-ckeditor-5 to my site, I got the following error:

django.core.exceptions.ImproperlyConfigured: CKEditor5Field is not supported by modeltranslation.

As I understand, the django-modeltranslation doesn't work with the field type 'CKEditor5Field'.

Is it possible to add support of CKEditor5Field field type to django-modetranslation?

@dmenisdev
Copy link

dmenisdev commented Feb 11, 2021

Instead of using the CKEditor5Field in your model use the widget in your Form.
Set your model field (back) to a TextField

If you want to use it in Django-admin override the form field in the admin.py:

from django_ckeditor_5.widgets import CKEditor5Widget

class [Your Model Name]Admin(ImportExportModelAdmin, admin.ModelAdmin):
  formfield_overrides = {
      models.TextField: {'widget': CKEditor5Widget},
  }

Hope this answers your question.

@hvlads useful to put in the readme? Happy to do so if you like :)

@Hopiu
Copy link
Contributor

Hopiu commented Jun 2, 2023

To use the CKEditor5Field with django-modeltranslation, you can add it to the MODELTRANSLATION_CUSTOM_FIELDS setting. This will add support for the field to be translated in the model.

Take a look at the documentation here https://django-modeltranslation.readthedocs.io/en/latest/installation.html#modeltranslation-custom-fields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants