Thursday, July 30, 2020

Attribute 'field_classes' is ignored when using with Admin GenericInlineForms

When I'm trying to change image field class with field_classes and use it in GenericTabularInline - nothing happens and Django's default ImageField is used.

admin.py

class ImageAttachmentForm(ModelForm):
    class Meta:
        model = ImageAttachment
        fields = ['image']
        field_classes = {
            'image'CustomImageFormField,
        }
class ImageAttachmentInline(GenericTabularInline):
    form = ImageAttachmentForm
    model = ImageAttachment
@admin.register(Pet)
class PetAdmin(ModelAdmin):
    inlines = [ImageAttachmentInline]


I've submitted a probable fix here: https://github.com/Tuoris/django/commit/b7151a0860363487d120e168866c9b95e715b526

Thanks, tuoris

No comments:

Post a Comment