Permalink
Browse files

Guard against double install

Fixes #10
  • Loading branch information...
1 parent 0469412 commit f6cb466c5477638aed94770d79e373b9456ffbcf @Suor committed Apr 30, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 cacheops/query.py
View
@@ -470,10 +470,17 @@ def invalidate_m2m(sender=None, instance=None, model=None, action=None, pk_set=N
invalidate_model(model)
+installed = False
+
def install_cacheops():
"""
Installs cacheops by numerous monkey patches
"""
+ global installed
+ if installed:
+ return # just return for now, second call is probably done due cycle imports
+ installed = True
+
monkey_mix(Manager, ManagerMixin)
monkey_mix(QuerySet, QuerySetMixin)
monkey_mix(ValuesQuerySet, QuerySetMixin, ['iterator'])

0 comments on commit f6cb466

Please sign in to comment.