Skip to content

Commit

Permalink
Remove pre-1.7 code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavisp3 committed Jan 21, 2016
1 parent 02731be commit 1dc7916
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
18 changes: 4 additions & 14 deletions generic_aggregation/utils.py
Expand Up @@ -2,10 +2,9 @@
Django does not properly set up casts
"""

import django
from django.contrib.contenttypes.generic import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import connection, models
from django.db import connection
from django.db.models.query import QuerySet


Expand All @@ -22,10 +21,7 @@ def normalize_qs_model(qs_or_model):
return qs_or_model._default_manager.all()

def get_field_type(f):
if django.VERSION < (1, 4):
raw_type = f.db_type()
else:
raw_type = f.db_type(connection)
raw_type = f.db_type(connection)
if raw_type.lower().split()[0] in ('serial', 'integer', 'unsigned', 'bigint', 'smallint'):
raw_type = 'integer'
return raw_type
Expand Down Expand Up @@ -178,16 +174,10 @@ def generic_filter(generic_qs_model, filter_qs_model, gfk_field=None):
# fallback methods

def query_as_sql(query):
if django.VERSION < (1, 2):
return query.as_sql()
else:
return query.get_compiler(connection=connection).as_sql()
return query.get_compiler(connection=connection).as_sql()

def query_as_nested_sql(query):
if django.VERSION < (1, 2):
return query.as_nested_sql()
else:
return query.get_compiler(connection=connection).as_nested_sql()
return query.get_compiler(connection=connection).as_nested_sql()

def gfk_expression(qs_model, gfk_field):
# handle casting the GFK field if need be
Expand Down
6 changes: 1 addition & 5 deletions runtests.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python
import sys
import django
from os.path import dirname, abspath

from django.conf import settings
Expand Down Expand Up @@ -37,10 +36,7 @@
),
)

if django.VERSION < (1, 6):
app_to_test = 'generic_aggregation_tests'
else:
app_to_test = 'generic_aggregation.generic_aggregation_tests'
app_to_test = 'generic_aggregation.generic_aggregation_tests'

from django.test.utils import get_runner

Expand Down

0 comments on commit 1dc7916

Please sign in to comment.