Fixes for Django 1.9

This commit is contained in:
Michał Hernas 2016-03-08 19:54:30 +01:00
parent 647fdb51d2
commit 044fefa420
2 changed files with 6 additions and 4 deletions

View File

@ -6,10 +6,9 @@ The appropriate renderer is called during Django's template response rendering.
"""
from __future__ import unicode_literals
import django
from django.core.handlers.wsgi import STATUS_CODE_TEXT
from django.template.response import SimpleTemplateResponse
from django.utils import six
import httplib
class Response(SimpleTemplateResponse):
"""
@ -81,7 +80,7 @@ class Response(SimpleTemplateResponse):
"""
# TODO: Deprecate and use a template tag instead
# TODO: Status code text for RFC 6585 status codes
return STATUS_CODE_TEXT.get(self.status_code, '')
return httplib[self.status_code]
def __getstate__(self):
"""

View File

@ -1081,7 +1081,10 @@ class ModelSerializer(Serializer):
self.save_object(related)
else:
# Reverse FK or reverse one-one
try:
setattr(obj, accessor_name, related)
except ValueError:
getattr(obj, accessor_name).add(*related, bulk=False)
del(obj._related_data)