Tests: remove Django 1.1 compatibility check
parent
25aa32d7bd
commit
2d83124f51
|
|
@ -6,6 +6,7 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
import sys
|
import sys
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
import uuid
|
||||||
|
|
||||||
from django import VERSION as django_VERSION
|
from django import VERSION as django_VERSION
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
@ -18,6 +19,7 @@ from django.contrib.contenttypes.models import ContentType
|
||||||
from polymorphic import PolymorphicModel, PolymorphicManager, PolymorphicQuerySet
|
from polymorphic import PolymorphicModel, PolymorphicManager, PolymorphicQuerySet
|
||||||
from polymorphic import ShowFieldContent, ShowFieldType, ShowFieldTypeAndContent, get_version
|
from polymorphic import ShowFieldContent, ShowFieldType, ShowFieldTypeAndContent, get_version
|
||||||
from polymorphic import translate_polymorphic_Q_object
|
from polymorphic import translate_polymorphic_Q_object
|
||||||
|
from polymorphic.tools_for_tests import UUIDField
|
||||||
|
|
||||||
class PlainA(models.Model):
|
class PlainA(models.Model):
|
||||||
field1 = models.CharField(max_length=10)
|
field1 = models.CharField(max_length=10)
|
||||||
|
|
@ -166,27 +168,20 @@ class Bottom(Middle):
|
||||||
author = models.CharField(max_length=50)
|
author = models.CharField(max_length=50)
|
||||||
|
|
||||||
|
|
||||||
# UUID tests won't work with Django 1.1
|
class UUIDProject(ShowFieldTypeAndContent, PolymorphicModel):
|
||||||
if not (django_VERSION[0] <= 1 and django_VERSION[1] <= 1):
|
|
||||||
try: from polymorphic.tools_for_tests import UUIDField
|
|
||||||
except: pass
|
|
||||||
if 'UUIDField' in globals():
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
class UUIDProject(ShowFieldTypeAndContent, PolymorphicModel):
|
|
||||||
uuid_primary_key = UUIDField(primary_key = True)
|
uuid_primary_key = UUIDField(primary_key = True)
|
||||||
topic = models.CharField(max_length = 30)
|
topic = models.CharField(max_length = 30)
|
||||||
class UUIDArtProject(UUIDProject):
|
class UUIDArtProject(UUIDProject):
|
||||||
artist = models.CharField(max_length = 30)
|
artist = models.CharField(max_length = 30)
|
||||||
class UUIDResearchProject(UUIDProject):
|
class UUIDResearchProject(UUIDProject):
|
||||||
supervisor = models.CharField(max_length = 30)
|
supervisor = models.CharField(max_length = 30)
|
||||||
|
|
||||||
class UUIDPlainA(models.Model):
|
class UUIDPlainA(models.Model):
|
||||||
uuid_primary_key = UUIDField(primary_key = True)
|
uuid_primary_key = UUIDField(primary_key = True)
|
||||||
field1 = models.CharField(max_length=10)
|
field1 = models.CharField(max_length=10)
|
||||||
class UUIDPlainB(UUIDPlainA):
|
class UUIDPlainB(UUIDPlainA):
|
||||||
field2 = models.CharField(max_length=10)
|
field2 = models.CharField(max_length=10)
|
||||||
class UUIDPlainC(UUIDPlainB):
|
class UUIDPlainC(UUIDPlainB):
|
||||||
field3 = models.CharField(max_length=10)
|
field3 = models.CharField(max_length=10)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -303,7 +298,6 @@ class PolymorphicTests(TestCase):
|
||||||
|
|
||||||
def test_primary_key_custom_field_problem(self):
|
def test_primary_key_custom_field_problem(self):
|
||||||
"object retrieval problem occuring with some custom primary key fields (UUIDField as test case)"
|
"object retrieval problem occuring with some custom primary key fields (UUIDField as test case)"
|
||||||
if not 'UUIDField' in globals(): return
|
|
||||||
a=UUIDProject.objects.create(topic="John's gathering")
|
a=UUIDProject.objects.create(topic="John's gathering")
|
||||||
b=UUIDArtProject.objects.create(topic="Sculpting with Tim", artist="T. Turner")
|
b=UUIDArtProject.objects.create(topic="Sculpting with Tim", artist="T. Turner")
|
||||||
c=UUIDResearchProject.objects.create(topic="Swallow Aerodynamics", supervisor="Dr. Winter")
|
c=UUIDResearchProject.objects.create(topic="Swallow Aerodynamics", supervisor="Dr. Winter")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue