commit
758eb577e4
|
|
@ -3,7 +3,7 @@
|
|||
Please see README.rst or DOCS.rst or http://bserve.webhop.org/wiki/django_polymorphic
|
||||
"""
|
||||
|
||||
import settings
|
||||
from django.conf import settings
|
||||
import sys
|
||||
from pprint import pprint
|
||||
|
||||
|
|
@ -582,7 +582,7 @@ __test__ = {"doctest": """
|
|||
>>> type(ModelWithMyManager.objects)
|
||||
<class 'polymorphic.tests.MyManager'>
|
||||
>>> type(ModelWithMyManager._default_manager)
|
||||
<class 'polymorphic.tests.MyManager'>
|
||||
<class 'polymorphic.manager.PolymorphicManager'>
|
||||
|
||||
|
||||
### Manager Inheritance
|
||||
|
|
@ -592,11 +592,11 @@ __test__ = {"doctest": """
|
|||
|
||||
# check for correct default manager
|
||||
>>> type(MROBase1._default_manager)
|
||||
<class 'polymorphic.tests.MyManager'>
|
||||
<class 'polymorphic.manager.PolymorphicManager'>
|
||||
|
||||
# Django vanilla inheritance does not inherit MyManager as _default_manager here
|
||||
>>> type(MROBase2._default_manager)
|
||||
<class 'polymorphic.tests.MyManager'>
|
||||
<class 'polymorphic.manager.PolymorphicManager'>
|
||||
|
||||
|
||||
### fixed issue in PolymorphicModel.__getattribute__: field name same as model name
|
||||
|
|
|
|||
|
|
@ -84,7 +84,9 @@ class UUIDField(models.CharField):
|
|||
|
||||
def db_type(self, connection):
|
||||
from django.conf import settings
|
||||
return UUIDField._CREATE_COLUMN_TYPES.get(settings.DATABASE_ENGINE, "char(%s)" % self.max_length)
|
||||
full_database_type = settings.DATABASES['default']['ENGINE']
|
||||
database_type = full_database_type.split('.')[-1]
|
||||
return UUIDField._CREATE_COLUMN_TYPES.get(database_type, "char(%s)" % self.max_length)
|
||||
|
||||
def to_python(self, value):
|
||||
"""Return a uuid.UUID instance from the value returned by the database."""
|
||||
|
|
|
|||
26
settings.py
26
settings.py
|
|
@ -9,28 +9,12 @@ ADMINS = (
|
|||
|
||||
MANAGERS = ADMINS
|
||||
|
||||
import django
|
||||
import os
|
||||
|
||||
if os.path.ismount('/ram'):
|
||||
SQLITE_DB_PATH = '/ram/django-polymorphic-test-db.sqlite3'
|
||||
else:
|
||||
SQLITE_DB_PATH = '/var/tmp/django-polymorphic-test-db.sqlite3'
|
||||
|
||||
if django.VERSION[:2][0]>=1 and django.VERSION[:2][1]>=3:
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': SQLITE_DB_PATH
|
||||
}
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': ':memory:'
|
||||
}
|
||||
else:
|
||||
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
|
||||
DATABASE_NAME = SQLITE_DB_PATH # Or path to database file if using sqlite3.
|
||||
DATABASE_USER = '' # Not used with sqlite3.
|
||||
DATABASE_PASSWORD = '' # Not used with sqlite3.
|
||||
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
|
||||
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
|
||||
}
|
||||
|
||||
# Local time zone for this installation. Choices can be found here:
|
||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
[tox]
|
||||
envlist=
|
||||
py26-django15,
|
||||
py27-django15,
|
||||
py26-django14,
|
||||
py27-django14,
|
||||
|
||||
[testenv]
|
||||
commands=
|
||||
python manage.py test
|
||||
|
||||
# Build configurations
|
||||
|
||||
[testenv:py26-django15]
|
||||
basepython=python2.6
|
||||
deps=
|
||||
django==1.5
|
||||
|
||||
[testenv:py27-django15]
|
||||
basepython=python2.7
|
||||
deps=
|
||||
django==1.5
|
||||
|
||||
[testenv:py26-django14]
|
||||
basepython=python2.6
|
||||
deps=
|
||||
django==1.4.5
|
||||
|
||||
[testenv:py27-django14]
|
||||
basepython=python2.7
|
||||
deps=
|
||||
django==1.4.5
|
||||
|
||||
Loading…
Reference in New Issue