-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from paulocheque/cannot-save-polymorphic
Django-Polymorphic support
- Loading branch information
Showing
7 changed files
with
83 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
from django.test import TestCase | ||
import pytest | ||
|
||
from django_dynamic_fixture.models_test import * | ||
from django_dynamic_fixture.ddf import * | ||
from django_dynamic_fixture import G | ||
|
||
try: | ||
from polymorphic.models import PolymorphicModel | ||
|
||
class PolymorphicModelTest(TestCase): | ||
def test_create_polymorphic_model_and_retrieve(self): | ||
p = G(ModelPolymorphic) | ||
assert list(ModelPolymorphic.objects.all()) == [p] | ||
|
||
def test_create_polymorphic_model_2_and_retrieve(self): | ||
p = G(ModelPolymorphic2) | ||
assert list(ModelPolymorphic2.objects.all()) == [p] | ||
|
||
def test_cannot_save(self): | ||
with self.assertRaises(BadDataError): | ||
G(ModelPolymorphic3) | ||
except ImportError: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
# Python2/3 compatibility | ||
six | ||
|
||
# For the Nose plugin | ||
nose>=1.3 | ||
django-nose>=1.4.5 | ||
nose-progressive>=1.5 | ||
|
||
six | ||
|
||
jsonfield | ||
django-json-field | ||
|
||
# Database Drivers | ||
#mysql-python | ||
#psycopg2 # not pypy compatible | ||
#psycopg2cffi # pypy2+ compatible | ||
|
||
# DjangoGEO | ||
geopy | ||
|
||
# 3rd party libraries | ||
jsonfield | ||
django-json-field | ||
django-polymorphic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters