File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 4
4
5
5
#### Pagination controls in the browsable API.
6
6
7
- #### New pagination schemes.
7
+ #### New schemes, including cursor pagination .
8
8
9
9
#### Support for header-based pagination.
10
10
11
11
## Versioning
12
12
13
13
## Internationalization
14
14
15
+ ## New fields
16
+
15
17
## ModelSerializer API
Original file line number Diff line number Diff line change 4
4
from __future__ import unicode_literals
5
5
from django .core .exceptions import PermissionDenied
6
6
from django .http import Http404
7
+ from django .utils import six
7
8
from django .utils .encoding import smart_text
8
9
from django .utils .translation import ugettext_lazy as _
9
10
from django .views .decorators .csrf import csrf_exempt
@@ -74,11 +75,13 @@ def exception_handler(exc, context):
74
75
return Response (data , status = exc .status_code , headers = headers )
75
76
76
77
elif isinstance (exc , Http404 ):
77
- data = {'detail' : _ ('Not found.' )}
78
+ msg = _ ('Not found.' )
79
+ data = {'detail' : six .text_type (msg )}
78
80
return Response (data , status = status .HTTP_404_NOT_FOUND )
79
81
80
82
elif isinstance (exc , PermissionDenied ):
81
- data = {'detail' : _ ('Permission denied.' )}
83
+ msg = _ ('Permission denied.' )
84
+ data = {'detail' : six .text_type (msg )}
82
85
return Response (data , status = status .HTTP_403_FORBIDDEN )
83
86
84
87
# Note: Unhandled exceptions will raise a 500 error.
Original file line number Diff line number Diff line change @@ -483,7 +483,7 @@ def test_get_instance_view_filters_out_name_with_filter_backend(self):
483
483
request = factory .get ('/1' )
484
484
response = instance_view (request , pk = 1 ).render ()
485
485
self .assertEqual (response .status_code , status .HTTP_404_NOT_FOUND )
486
- self .assertEqual (response .data , {'detail' : 'Not found' })
486
+ self .assertEqual (response .data , {'detail' : 'Not found. ' })
487
487
488
488
def test_get_instance_view_will_return_single_object_when_filter_does_not_exclude_it (self ):
489
489
"""
You can’t perform that action at this time.