Skip to content
Browse files

reverted last commit and added djago version check to the previous

version of __conform__
  • Loading branch information...
1 parent 299e3dc commit 26bcc82affbc1605c58ed016fb0a231e20039135 @czervenka czervenka committed
Showing with 12 additions and 3 deletions.
  1. +12 −3 djangomarkup/fields.py
View
15 djangomarkup/fields.py
@@ -23,10 +23,19 @@ def __str__(self):
return smart_str(self)
def __conform__(self, x):
- from django import db
- engine = getattr(db.settings, 'DATABASE_ENGINE', None)
+ from django import VERSION
+
+ if VERSION >= (1,3):
+ # do not try new settings format for older django versions which
+ # still ignores it
+ try:
+ engine = settings.DATABASES['default']['ENGINE'].split('.')[-1]
+ except (KeyError, AttributeError):
+ engine = getattr(settings, 'DATABASE_ENGINE', '').split('.')[-1]
+ else:
+ engine = getattr(settings, 'DATABASE_ENGINE', '').split('.')[-1]
- if engine.startswith('postgresql'):
+ if 'postgresql' in engine:
# hack to enable psycopg2's adapting to work
# on something that is not a unicode
from psycopg2.extensions import adapt

0 comments on commit 26bcc82

Please sign in to comment.
Something went wrong with that request. Please try again.