#26472: allow model field level silencing of system checks (e.g.: W342)
--------------------------------------+--------------------
     Reporter:  zsoldosp              |      Owner:  nobody
         Type:  New feature           |     Status:  new
    Component:  Core (System checks)  |    Version:  1.8
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+--------------------
 ==== Proposal ====

 Add an optional kwarg to modelfields called
 `silenced_system_check=<iterable>`, which would default to `None` or an
 empty collection

 As  `CheckMessage` already has access to the object it applies to, it
 should be a matter of adding an extra check in `is_silenced`  to check
 whether the warning id is present in the global system settings or inside
 the modelfield's own silenced system checks

 https://github.com/django/django/blob/master/django/core/checks/messages.py#L54

 ==== Context ====

 on a large application that was recently upgraded to 1.8, we wanted to add
 a step to the build to fail is `manage.py check` would report any
 warnings. However, there are many uses of
 `models.ForeignKey(unique=True)`, and thus upgrading all of them right now
 is not feasible. The only option we have is to use
 `settings.SILENCED_SYSTEM_CHECKS`, however, that silencing the warning
 there would apply to any new models/fields that are added, for which we
 would actually be happy to fail the build.

--
Ticket URL: <https://code.djangoproject.com/ticket/26472>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.8e64c58c9fbef10d6669a3e1cea3fbfe%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to