Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jelle van der Waa
Archweb
Commits
adaa6d64
Unverified
Commit
adaa6d64
authored
Jul 30, 2018
by
Aleksandar Trifunovic
Browse files
rewrite logic to put some key at the beginning of the OrderedDict
parent
cbf837ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
devel/forms.py
View file @
adaa6d64
...
...
@@ -53,15 +53,11 @@ class Meta:
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
NewUserForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
# Hack ourself so certain fields appear first
old
=
self
.
fields
self
.
fields
=
OrderedDict
()
keys
=
(
'username'
,
'private_email'
,
'first_name'
,
'last_name'
,
'alias'
,
'public_email'
)
for
key
in
keys
:
self
.
fields
[
key
]
=
old
[
key
]
for
key
,
_
in
list
(
old
.
items
()):
if
key
not
in
keys
:
self
.
fields
[
key
]
=
old
[
key
]
# add all remaining keys afterwards
keys
+=
tuple
(
k
for
k
in
self
.
fields
.
keys
()
if
k
not
in
keys
)
self
.
fields
=
OrderedDict
((
key
,
old
[
key
])
for
key
in
keys
)
def
clean_username
(
self
):
username
=
self
.
cleaned_data
[
'username'
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment