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

閲覧: 35 回
最初の未読メッセージにスキップ

Malcolm Box

未読、
2015/09/10 13:42:082015/09/10
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




全員に返信
投稿者に返信
転送
新着メール 0 件