mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-19 09:53:34 -06:00
Remove cacheops monkey patch for RestrictedQuerySet
This commit is contained in:
parent
0ef016db07
commit
c6fd6ab329
@ -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
|
|
Loading…
Reference in New Issue
Block a user