From cc42a1c109926d05d208439e7b0827ee46749c90 Mon Sep 17 00:00:00 2001 From: artscoop Date: Fri, 1 Aug 2014 07:33:21 +0200 Subject: [PATCH] Fix monkey patching in Django 1.7 and newer django.db.backends.util was deprecated and replaced with django.db.backends.utils in Django 1.7. Here we import util in Django 1.6 and older, and utils otherwise. --- readonly/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/readonly/__init__.py b/readonly/__init__.py index 8b387d2..4e63e3e 100644 --- a/readonly/__init__.py +++ b/readonly/__init__.py @@ -10,8 +10,14 @@ from time import time +import django from django.conf import settings -from django.db.backends import util + +if django.VERSION < (1, 7): + from django.db.backends import util +else: + from django.db.backends import utils as util + from django.utils.log import getLogger from .exceptions import DatabaseWriteDenied