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

Commit f34a062

Browse files
committed
Merge pull request #183 from YX4iHsvP/master
Pass input type for PasswordField to the constructor (Fixes #182)
2 parents ab02d5b + 80ca500 commit f34a062

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

rest_framework_jwt/compat.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ def object(self):
1818
return self.validated_data
1919

2020
class PasswordField(serializers.CharField):
21-
style = {
22-
'input_type': 'password'
23-
}
21+
22+
def __init__(self, *args, **kwargs):
23+
if 'style' not in kwargs:
24+
kwargs['style'] = {'input_type': 'password'}
25+
else:
26+
kwargs['style']['input_type'] = 'password'
27+
super(PasswordField, self).__init__(*args, **kwargs)
2428

2529

2630
def get_user_model():

0 commit comments

Comments
 (0)