Converting ModelAdmin system checks to run against instances rather than the class

35 views
Skip to first unread message

Malcolm Box

unread,
Sep 10, 2015, 1:42:08 PM9/10/15
to Django developers (Contributions to Django itself)
Hi,

Raising this here as suggested by Tim on this bug: https://code.djangoproject.com/ticket/25374, with discussion also on django users here: https://groups.google.com/forum/#!topic/django-users/lsDP5oUWOsw

The underlying bug is that ModelAdmin checks are run against the class not the instance - which means that checks can fail when the code actually works. This sort of false positive feels bad to me.

The proposed PR changes the ModelAdmin checks to validating the created instance that will be registered rather than the ModelAdmin class itself. This mirrors how Django actually uses the ModelAdmin objects, and means that validation checks that previously threw false positives now pass.

Does this change make sense, or is there something subtle that I'm missing? More broadly, am I right in thinking that false-positive system check errors are a bad thing, and so we should aim to minimise/eliminate them, even at the cost of potential false negatives?

Cheers,

Malcolm




Reply all
Reply to author
Forward
0 new messages