Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

seems we have connection w/o vendor

  • Loading branch information...
commit ed456ed613e104e6746c7c231cfa6b50746bf50d 1 parent 239b012
@sorl sorl authored
Showing with 4 additions and 5 deletions.
  1. +1 −1  setup.py
  2. +3 −4 stringfield/base.py
View
2  setup.py
@@ -10,7 +10,7 @@ def run(self):
setup(
name='django-stringfield',
- version='0.2.1',
+ version='0.2.2',
description='Better string field for Django.',
long_description=open('README.rst').read(),
author='Mikko Hellsing',
View
7 stringfield/base.py
@@ -27,16 +27,15 @@ def formfield(self, **kwargs):
return super(StringField, self).formfield(**defaults)
def db_type(self, connection=None):
- if connection is None:
- # Django < 1.2 doesn't have connection
+ if connection and hasattr(connection, 'vendor'):
+ vendor = connection.vendor
+ else:
from django.conf import settings
name = settings.DATABASE_ENGINE.split('.')[-1].split('_')[0]
if name == 'postgis':
vendor = 'postgresql'
else:
vendor = name
- else:
- vendor = connection.vendor
if vendor == 'postgresql':
return 'character varying'
if vendor == 'mysql':
Please sign in to comment.
Something went wrong with that request. Please try again.