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.