layers Introducing Unfold components - Pre-made HTML blocks in Django admin for custom dashboards arrow_forward

Unfold widget WysiwygWidget

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,
        }
    }

Be first to know about new features and updates

Each time something new happens in Unfold, like new major features or new design components, we'll send you a newsletter. We promise not to spam you.

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.