mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 01:57:00 +03:00
Fixes for Django 1.9
This commit is contained in:
parent
647fdb51d2
commit
044fefa420
|
@ -6,10 +6,9 @@ The appropriate renderer is called during Django's template response rendering.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import django
|
import django
|
||||||
from django.core.handlers.wsgi import STATUS_CODE_TEXT
|
|
||||||
from django.template.response import SimpleTemplateResponse
|
from django.template.response import SimpleTemplateResponse
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
import httplib
|
||||||
|
|
||||||
class Response(SimpleTemplateResponse):
|
class Response(SimpleTemplateResponse):
|
||||||
"""
|
"""
|
||||||
|
@ -81,7 +80,7 @@ class Response(SimpleTemplateResponse):
|
||||||
"""
|
"""
|
||||||
# TODO: Deprecate and use a template tag instead
|
# TODO: Deprecate and use a template tag instead
|
||||||
# TODO: Status code text for RFC 6585 status codes
|
# 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):
|
def __getstate__(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1081,7 +1081,10 @@ class ModelSerializer(Serializer):
|
||||||
self.save_object(related)
|
self.save_object(related)
|
||||||
else:
|
else:
|
||||||
# Reverse FK or reverse one-one
|
# Reverse FK or reverse one-one
|
||||||
|
try:
|
||||||
setattr(obj, accessor_name, related)
|
setattr(obj, accessor_name, related)
|
||||||
|
except ValueError:
|
||||||
|
getattr(obj, accessor_name).add(*related, bulk=False)
|
||||||
del(obj._related_data)
|
del(obj._related_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user