From 45cccc1e95256b50d8ea6ffb93441287c891841f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Moroz?= Date: Fri, 4 Oct 2024 19:49:11 +0200 Subject: [PATCH] fix: Prevent Periodical from being accessed by Django Debug Toolbar --- tasks/apps/tree/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tasks/apps/tree/views.py b/tasks/apps/tree/views.py index 40c0af7..74957c4 100644 --- a/tasks/apps/tree/views.py +++ b/tasks/apps/tree/views.py @@ -299,6 +299,10 @@ def __len__(self): return len(self.plans) def __getattr__(self, attr): + # Hack for django-debug-toolbar + if attr == '_wrapped': + raise AttributeError + attr1, attr2 = attr.split('__') return map(lambda x: getattr(x, attr2), getattr(self, attr1 + 's'))