1. Documentation
  2. Widgets
  3. ArrayWidget

Unfold widget ArrayWidget

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

© 2023 - 2025 Created by unfoldadmin.com. All rights reserved.