mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #7109 -- Quote certain values before passing them for substitution in
Field.db_type(). This fixes a problem with using reserved words for field names in Oracle. Only affects Oracle at the moment, but the same changes could easily be used by other backends if they are required (requires changing creation.py, only). This commit also reverts [7501] so that if the fix doesn't work, it will show up in the tests (and if it does work, the tests will prevent us from breaking it again). git-svn-id: http://code.djangoproject.com/svn/django/trunk@7743 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -16,6 +16,7 @@ from django.core import validators
|
||||
from django import oldforms
|
||||
from django import newforms as forms
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.utils.datastructures import DictWrapper
|
||||
from django.utils.functional import curry
|
||||
from django.utils.itercompat import tee
|
||||
from django.utils.text import capfirst
|
||||
@@ -161,8 +162,9 @@ class Field(object):
|
||||
# mapped to one of the built-in Django field types. In this case, you
|
||||
# can implement db_type() instead of get_internal_type() to specify
|
||||
# exactly which wacky database column type you want to use.
|
||||
data = DictWrapper(self.__dict__, connection.ops.quote_name, "qn_")
|
||||
try:
|
||||
return get_creation_module().DATA_TYPES[self.get_internal_type()] % self.__dict__
|
||||
return get_creation_module().DATA_TYPES[self.get_internal_type()] % data
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user