Skip to content

Commit 7a8dc23

Browse files
committed
Remove compatibility patches
1 parent 2bdec99 commit 7a8dc23

File tree

5 files changed

+11
-29
lines changed

5 files changed

+11
-29
lines changed

tagging/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"""
2+
Admin components for tagging.
3+
"""
14
from django.contrib import admin
25

36
from .models import Tag, TaggedItem

tagging/managers.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
Custom managers for Django models registered with the tagging
33
application.
44
"""
5-
6-
import django
7-
from django.contrib.contenttypes.models import ContentType
85
from django.db import models
6+
from django.contrib.contenttypes.models import ContentType
97

108
from .models import Tag, TaggedItem
119

@@ -19,10 +17,6 @@ def get_queryset(self):
1917
return Tag.objects.filter(
2018
items__content_type__pk=ctype.pk).distinct()
2119

22-
# TODO: drop this
23-
if django.VERSION < (1, 6):
24-
get_query_set = get_queryset
25-
2620
def cloud(self, *args, **kwargs):
2721
return Tag.objects.cloud_for_model(self.model, *args, **kwargs)
2822

tagging/models.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
from django.utils.encoding import python_2_unicode_compatible
88
from django.utils.translation import ugettext_lazy as _
99
from django.contrib.contenttypes.models import ContentType
10-
try:
11-
from django.contrib.contenttypes.fields import GenericForeignKey
12-
except ImportError: # Django 1.8
13-
from django.contrib.contenttypes.generic import GenericForeignKey
10+
from django.contrib.contenttypes.fields import GenericForeignKey
1411

1512
from . import settings
1613
from .utils import LOGARITHMIC
@@ -174,21 +171,9 @@ def usage_for_queryset(self, queryset, counts=False, min_count=None):
174171
greater than or equal to ``min_count`` will be returned.
175172
Passing a value for ``min_count`` implies ``counts=True``.
176173
"""
177-
178-
if getattr(queryset.query, 'get_compiler', None):
179-
compiler = queryset.query.get_compiler(using='default')
180-
if getattr(compiler, 'compile', None):
181-
# Django 1.7+
182-
where, params = compiler.compile(queryset.query.where)
183-
else:
184-
# Django 1.2+
185-
where, params = queryset.query.where.as_sql(
186-
compiler.quote_name_unless_alias, compiler.connection)
187-
extra_joins = ' '.join(compiler.get_from_clause()[0][1:])
188-
else:
189-
# Django pre-1.2
190-
extra_joins = ' '.join(queryset.query.get_from_clause()[0][1:])
191-
where, params = queryset.query.where.as_sql()
174+
compiler = queryset.query.get_compiler(using='default')
175+
where, params = compiler.compile(queryset.query.where)
176+
extra_joins = ' '.join(compiler.get_from_clause()[0][1:])
192177

193178
if where:
194179
extra_criteria = 'AND %s' % where

tagging/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
# The maximum length of a tag's name.
99
MAX_TAG_LENGTH = getattr(settings, 'MAX_TAG_LENGTH', 50)
1010

11-
# Whether to force all tags to lowercase before they are saved to the
12-
# database.
11+
# Whether to force all tags to lowercase
12+
# before they are saved to the database.
1313
FORCE_LOWERCASE_TAGS = getattr(settings, 'FORCE_LOWERCASE_TAGS', False)

tagging/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"""
55
import math
66

7-
from django.db.models.query import QuerySet
87
from django.utils import six
8+
from django.db.models.query import QuerySet
99
from django.utils.encoding import force_text
1010
from django.utils.translation import ugettext as _
1111

0 commit comments

Comments
 (0)