diff --git a/fuzzycount.py b/fuzzycount.py index 1f42011..3bf006d 100644 --- a/fuzzycount.py +++ b/fuzzycount.py @@ -1,13 +1,6 @@ -from distutils.version import LooseVersion - from django.conf import settings from django.db import connections from django.db.models import QuerySet, Manager -import django - - -DJANGO_VERSION_GTE_19 = LooseVersion(django.get_version()) \ - >= LooseVersion('1.9') class FuzzyCountQuerySet(QuerySet): @@ -16,15 +9,7 @@ def count(self): engine = settings.DATABASES[self.db]["ENGINE"].split(".")[-1] is_postgres = engine.startswith(postgres_engines) - # In Django 1.9 the query.having property was removed and the - # query.where property will be truthy if either where or having - # clauses are present. In earlier versions these were two separate - # properties query.where and query.having - if DJANGO_VERSION_GTE_19: - is_filtered = self.query.where - else: - is_filtered = self.query.where or self.query.having - if not is_postgres or is_filtered: + if not is_postgres or self.query.where: return super(FuzzyCountQuerySet, self).count() cursor = connections[self.db].cursor() cursor.execute("SELECT reltuples FROM pg_class " diff --git a/setup.py b/setup.py index b265617..7342e51 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ py_modules=["fuzzycount",], install_requires = [ "sphinx-me >= 0.1.2", - "django >= 1.7", + "django >= 1.9", ], classifiers = [ "Development Status :: 5 - Production/Stable",