admin.E035 System Check Error with TabularInline

Hi Folks

When using a __ lookup in the fields and readonly_fields of a TabularInline I get an admin.E035 error when running the system’s check. ./manage.py check. However in the Admin interface it works perfectly fine.

Based on the docs for ModelAdmin fields the use of __ is not supported. So in theory the error is correct, however as mentioned it’s actually working fine when view the Model in the admin.

As an example I have the following inline

class SubscriptionInline(admin.TabularInline):

    model = PDJSubscription
    extra = 0
    fields = (
        'name',
        'state',
        'cancelled',
        'djs_subscription_link',
        'djs_subscription__current_period_end',
    )
    readonly_fields = (
        'cancelled',
        'djs_subscription_link',
        'djs_subscription__current_period_end',
    )
    list_display = ('id', 'name', 'state', 'djs_subscription_link', 'cancelled')
    ordering = ('-created_at',)

    def djs_subscription_link(self, obj: PDJSubscription) -> str:
        url = reverse('admin:djstripe_subscription_change', args=[obj.djs_subscription.pk])
        return format_html('<a href="{}">{}</a>', url, obj.djs_subscription)

Notice the use of 'djs_subscription__current_period_end', which refers to dj-stripe Subscription model. Basically the relationship is PDJSubscriptiondjstripe.models.billing.Subscription looking up the field current_period_end.

When viewing this in the Admin Interface the current_period_end is displayed fine, however the system check fails.

Perhaps an undocumented feature or maybe a side effect of the new functionality in Django 5.1:

ModelAdmin.list_display now supports using __ lookups to list fields from related models.

Cheers

Gary