[Django]-How to customize the admin form for a custom image model in Wagtail CMS?

4👍

Images in Wagtail don’t use WagtailAdminModelForm or the base_form_class attribute – these are used by pages, snippets and ModelAdmin to support Wagtail-specific features like inline children and panels, but images work through plain Django models and forms.

You can customise the form by subclassing BaseImageForm and setting WAGTAILIMAGES_IMAGE_FORM_BASE in your project settings. As long as you define your form class somewhere outside of models.py (e.g. in a separate forms.py module), you’ll avoid the circular dependency that leads to the "Models aren’t loaded yet" error.

👤gasman

Leave a comment