# settings.py
INSTALLED_APPS = [
"unfold",
"unfold.contrib.forms",
]
Below you can see how to use ArrayWidget in your admin class. In this example all ArrayField
fields will use ArrayWidget
to render input field. In case choices
are provided for the widget, dropdown list will be used instead of text input.
# admin.py
from django.contrib import admin
from django.contrib.postgres.fields import ArrayField
from unfold.admin import ModelAdmin
from unfold.contrib.forms.widgets import ArrayWidget
@admin.register(MyModel)
class CustomAdminClass(ModelAdmin):
formfield_overrides = {
ArrayField: {
"widget": ArrayWidget,
}
}
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.