From e263cc0dc53577d525aad0546fc1bd5939dc2e0b Mon Sep 17 00:00:00 2001 From: Matt Boersma Date: Fri, 21 Aug 2009 21:42:39 +0000 Subject: Fixed #11049: introspection on Oracle now identifies IntegerFields correctly. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11475 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/oracle/introspection.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'django/db/backends/oracle/introspection.py') diff --git a/django/db/backends/oracle/introspection.py b/django/db/backends/oracle/introspection.py index 543e84a8f3..0b4f61a360 100644 --- a/django/db/backends/oracle/introspection.py +++ b/django/db/backends/oracle/introspection.py @@ -26,6 +26,14 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): except AttributeError: pass + def get_field_type(self, data_type, description): + # If it's a NUMBER with scale == 0, consider it an IntegerField + if data_type == cx_Oracle.NUMBER and description[5] == 0: + return 'IntegerField' + else: + return super(DatabaseIntrospection, self).get_field_type( + data_type, description) + def get_table_list(self, cursor): "Returns a list of table names in the current database." cursor.execute("SELECT TABLE_NAME FROM USER_TABLES") -- cgit v1.2.1