Skip to content
This repository was archived by the owner on May 26, 2020. It is now read-only.

Commit 7adfe48

Browse files
committed
Use request.data in DRF >= 3
1 parent 72f4dc3 commit 7adfe48

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

rest_framework_jwt/compat.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
from django.forms import widgets
66

77

8-
if StrictVersion(rest_framework.VERSION) < StrictVersion('3.0.0'):
8+
DRF_VERSION_INFO = StrictVersion(rest_framework.VERSION).version
9+
DRF2 = DRF_VERSION_INFO[0] == 2
10+
DRF3 = DRF_VERSION_INFO[0] == 3
11+
12+
13+
if DRF2:
914
class Serializer(serializers.Serializer):
1015
pass
1116

@@ -57,10 +62,8 @@ def get_username(user):
5762

5863

5964
def get_request_data(request):
60-
if getattr(request, 'data', None):
61-
data = request.data
62-
else:
63-
# DRF < 3.2
65+
if DRF2:
6466
data = request.DATA
65-
67+
else:
68+
data = request.data
6669
return data

0 commit comments

Comments
 (0)