To use WysiwygWidget, you need to have unfold.contrib.forms
in INSTALLED_APPS
which is required dependency. The WYSIWYG widget is based on django-ckeditor.
# settings.py
INSTALLED_APPS = [
"unfold",
"unfold.contrib.forms",
]
Below is simple example replacing all TextField
fields with WysiwygWidget
in admin particular admin class. At the moment WysiwygWidget
does not support file upload but it is still possible to manually upload an image and then link it into the content area.
# admin.py
from django.db import models
from unfold.admin import ModelAdmin
from unfold.contrib.forms.widgets import WysiwygWidget
@admin.register(MyModel)
class CustomAdminClass(ModelAdmin):
formfield_overrides = {
models.TextField: {
"widget": WysiwygWidget,
}
}
Django admin theme built with Tailwind CSS to bring modern look and feel to your admin interface. Already contains several built-in features for smooth developer experience.
© 2023 - 2024 Created by unfoldadmin.com. All rights reserved.