From c6fd6ab329929466db47aa847c775c9c33bbf34a Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 20 Jul 2020 16:54:24 -0400 Subject: [PATCH] Remove cacheops monkey patch for RestrictedQuerySet --- netbox/netbox/__init__.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/netbox/netbox/__init__.py b/netbox/netbox/__init__.py index 034c9c80e..e69de29bb 100644 --- a/netbox/netbox/__init__.py +++ b/netbox/netbox/__init__.py @@ -1,17 +0,0 @@ -from cacheops.query import ManagerMixin, no_invalidation, _old_objs - - -# Monkey-patch cacheops' _pre_save() signal receiver. This is needed to mark the sending model's QuerySet as -# unrestricted. -def _pre_save(self, sender, instance, using, **kwargs): - if not (instance.pk is None or instance._state.adding or no_invalidation.active): - try: - qs = sender.objects.using(using) - if hasattr(qs, 'restrict'): - qs = qs.unrestricted() - _old_objs.__dict__[sender, instance.pk] = qs.get(pk=instance.pk) - except sender.DoesNotExist: - pass - - -ManagerMixin._pre_save = _pre_save