Skip to content

Commit 20b27d2

Browse files
Maffoochclaude
andauthored
Silence polymorphic.W001 and polymorphic.W002 system checks (#14393)
The Question and Answer models intentionally use models.Manager() as their default objects manager instead of PolymorphicManager(). This is a deliberate trade-off introduced in #9574 to fix cascade deletion failures (ForeignKeyViolation on dojo_choiceanswer and ValueError during Product/ProductType deletion) caused by Django's inability to correctly order polymorphic child row deletions before parent row deletions when using PolymorphicManager as the default. Using models.Manager() as the default ensures Django's collector can walk the full object graph and delete child rows (TextAnswer, ChoiceAnswer) before their parent Answer rows, satisfying FK constraints. A named polymorphic manager is retained on both models for all queryset operations that require polymorphic behavior (used throughout dojo/survey/views.py and dojo/forms.py). The resulting polymorphic.W001 and polymorphic.W002 warnings are therefore expected and benign — they describe the intentional configuration, not a bug. Silencing them here prevents noise in CI and local development output without masking any real misconfiguration. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 399ff7e commit 20b27d2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

dojo/settings/settings.dist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# django-jsonfield-backport raises a warning that can be ignored,
3535
# see https://github.com/laymonage/django-jsonfield-backport
3636
# debug_toolbar.E001 is raised when running tests in dev mode via run-unittests.sh
37-
DD_SILENCED_SYSTEM_CHECKS=(list, ["debug_toolbar.E001", "django_jsonfield_backport.W001"]),
37+
DD_SILENCED_SYSTEM_CHECKS=(list, ["debug_toolbar.E001", "django_jsonfield_backport.W001", "polymorphic.W001", "polymorphic.W002"]),
3838
DD_TEMPLATE_DEBUG=(bool, False),
3939
DD_LOG_LEVEL=(str, ""),
4040
DD_DJANGO_METRICS_ENABLED=(bool, False),

0 commit comments

Comments
 (0)