Override field widget in Django admin form

Mar 06, 2015 · Updated: Jul 12, 2021 · by Tim Kamanin

Approach 1

Override all widgets of a given type in a form. In this example we set CKEditor widget for all textfields in the form.
class BlogAdmin(admin.ModelAdmin):

    formfield_overrides = {
        models.TextField: {"widget": CKEditorWidget},

Approach 2

Override widget only for a desired field in the form.
class BlogAdminForm(ModelForm):
    class Meta:
        model = Blog
        widgets = {
            "body": CKEditorWidget(),
class BlogAdmin(admin.ModelAdmin):
    form = BlogAdminForm

Hey, if you've found this useful, please share the post to help other folks find it:

There's even more:

Subscribe for updates

  • via Twitter: @timonweb
  • old school RSS:
  • or evergreen email ↓ ↓ ↓