Skip to content

Commit 3e8d8bb

Browse files
committed
Fixed auth to not use an internal implementation detail of SortedDict
1 parent 8f00286 commit 3e8d8bb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

django/contrib/auth/forms.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from django import forms
44
from django.forms.util import flatatt
55
from django.template import loader
6+
from django.utils.datastructures import SortedDict
67
from django.utils.html import format_html, format_html_join
78
from django.utils.http import int_to_base36
89
from django.utils.safestring import mark_safe
@@ -14,6 +15,7 @@
1415
from django.contrib.auth.tokens import default_token_generator
1516
from django.contrib.sites.models import get_current_site
1617

18+
1719
UNMASKED_DIGITS_TO_SHOW = 6
1820

1921
mask_password = lambda p: "%s%s" % (p[:UNMASKED_DIGITS_TO_SHOW], "*" * max(len(p) - UNMASKED_DIGITS_TO_SHOW, 0))
@@ -293,8 +295,11 @@ def clean_old_password(self):
293295
raise forms.ValidationError(
294296
self.error_messages['password_incorrect'])
295297
return old_password
296-
PasswordChangeForm.base_fields.keyOrder = ['old_password', 'new_password1',
297-
'new_password2']
298+
299+
PasswordChangeForm.base_fields = SortedDict([
300+
(k, PasswordChangeForm.base_fields[k])
301+
for k in ['old_password', 'new_password1', 'new_password2']
302+
])
298303

299304

300305
class AdminPasswordChangeForm(forms.Form):

0 commit comments

Comments
 (0)