Attribute 'field_classes' is ignored when using with Admin GenericInlineForms

21 views
Skip to first unread message

Yuriy Tupychak

unread,
Jul 30, 2020, 5:53:18 AM7/30/20
to django...@googlegroups.com
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

Reply all
Reply to author
Forward
0 new messages