Permalink
Browse files

Removing normalize hook

  • Loading branch information...
1 parent d746e76 commit d8b3d38f1aa5cecfb98fc5f5db5ef7a28cedac78 Charles Leifer committed Mar 27, 2013
Showing with 10 additions and 7 deletions.
  1. +3 −4 generic_aggregation/utils.py
  2. +7 −3 runtests.py
@@ -21,12 +21,12 @@ def normalize_qs_model(qs_or_model):
return qs_or_model
return qs_or_model._default_manager.all()
-def get_field_type(f, normalize=True):
+def get_field_type(f):
if django.VERSION < (1, 4):
raw_type = f.db_type()
else:
raw_type = f.db_type(connection)
- if normalize and raw_type.lower().split()[0] in ('serial', 'integer', 'unsigned', 'bigint', 'smallint'):
+ if raw_type.lower().split()[0] in ('serial', 'integer', 'unsigned', 'bigint', 'smallint'):
raw_type = 'integer'
return raw_type
@@ -194,12 +194,11 @@ def gfk_expression(qs_model, gfk_field):
qn = connection.ops.quote_name
pk_field_type = get_field_type(qs_model._meta.pk)
- pk_field_type_raw = get_field_type(qs_model._meta.pk, False)
gfk_field_type = get_field_type(gfk_field.model._meta.get_field(gfk_field.fk_field))
if pk_field_type != gfk_field_type:
# cast the gfk to the pk type
- gfk_expr = "CAST(%s AS %s)" % (qn(gfk_field.fk_field), pk_field_type_raw)
+ gfk_expr = "CAST(%s AS %s)" % (qn(gfk_field.fk_field), pk_field_type)
else:
gfk_expr = qn(gfk_field.fk_field) # the object_id field on the GFK
View
@@ -4,9 +4,13 @@
from django.conf import settings
-if len(sys.argv) > 1 and 'postgres' in sys.argv:
- sys.argv.remove('postgres')
- db_engine = 'django.db.backends.postgresql_psycopg2'
+if len(sys.argv) > 1:
+ if 'postgres' in sys.argv:
+ sys.argv.remove('postgres')
+ db_engine = 'django.db.backends.postgresql_psycopg2'
+ elif 'mysql' in sys.argv:
+ sys.argv.remove('mysql')
+ db_engine = 'django.db.backends.mysql'
db_name = 'test_main'
else:
db_engine = 'django.db.backends.sqlite3'

0 comments on commit d8b3d38

Please sign in to comment.