mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-12-01 14:04:02 +03:00
Use api_settings.URL_FIELD_NAME
This commit is contained in:
parent
d20c49da4a
commit
dde3b1dfcb
|
@ -11,6 +11,7 @@ from django.http import Http404
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.request import clone_request
|
from rest_framework.request import clone_request
|
||||||
|
from rest_framework.settings import api_settings
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ class CreateModelMixin(object):
|
||||||
|
|
||||||
def get_success_headers(self, data):
|
def get_success_headers(self, data):
|
||||||
try:
|
try:
|
||||||
return {'Location': data['url']}
|
return {'Location': data[api_settings.URL_FIELD_NAME]}
|
||||||
except (TypeError, KeyError):
|
except (TypeError, KeyError):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user