Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django 1.9 support #199

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions swampdragon/serializers/model_serializer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
from django.core.exceptions import ValidationError
from django.db.models.fields.related import ReverseSingleRelatedObjectDescriptor, ForeignRelatedObjectsDescriptor, \
ReverseManyRelatedObjectsDescriptor, ManyRelatedObjectsDescriptor
try:
from django.db.models.fields.related import ReverseSingleRelatedObjectDescriptor, ForeignRelatedObjectsDescriptor, \
ReverseManyRelatedObjectsDescriptor, ManyRelatedObjectsDescriptor
except ImportError:
from django.db.models.fields.related_descriptors import ForwardManyToOneDescriptor as \
ReverseSingleRelatedObjectDescriptor, ReverseManyToOneDescriptor as ForeignRelatedObjectsDescriptor, \
ManyToManyDescriptor as ManyRelatedObjectsDescriptor
ReverseManyRelatedObjectsDescriptor = ForeignRelatedObjectsDescriptor
from swampdragon.model_tools import get_property, get_model
from swampdragon.serializers.field_serializers import serialize_field
from swampdragon.serializers.object_map import get_object_map
Expand Down
11 changes: 9 additions & 2 deletions swampdragon/serializers/object_map.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
from django.db.models.fields.related import ReverseSingleRelatedObjectDescriptor, SingleRelatedObjectDescriptor, \
ForeignRelatedObjectsDescriptor, ManyRelatedObjectsDescriptor, ReverseManyRelatedObjectsDescriptor
try:
from django.db.models.fields.related import ReverseSingleRelatedObjectDescriptor, SingleRelatedObjectDescriptor, \
ForeignRelatedObjectsDescriptor, ManyRelatedObjectsDescriptor, ReverseManyRelatedObjectsDescriptor
except ImportError:
from django.db.models.fields.related_descriptors import ForwardManyToOneDescriptor as \
ReverseSingleRelatedObjectDescriptor, ReverseOneToOneDescriptor as SingleRelatedObjectDescriptor,\
ReverseManyToOneDescriptor as ForeignRelatedObjectsDescriptor,\
ManyToManyDescriptor as ManyRelatedObjectsDescriptor
ReverseManyRelatedObjectsDescriptor = None


def _construct_graph(parent_type, child_type, via, is_collection, property_name):
Expand Down