authentic agent: respect profile field order (#22645)

This commit is contained in:
Frédéric Péters 2018-03-20 15:49:59 +01:00
parent c46b9b1f82
commit 456ca1b8e3
1 changed files with 2 additions and 1 deletions

View File

@ -61,7 +61,7 @@ class Command(hobo_deploy.Command):
# create/update user attributes
fields = []
disabled_fields = []
for attribute in hobo_environment.get('profile', {}).get('fields'):
for i, attribute in enumerate(hobo_environment.get('profile', {}).get('fields')):
if attribute['name'] == 'email':
# this field is hardcoded in the user model, don't add
# it as a new attribute, but add it to the fields list,
@ -74,6 +74,7 @@ class Command(hobo_deploy.Command):
for key in ('label', 'description', 'asked_on_registration',
'user_editable', 'user_visible', 'required'):
setattr(attr, key, attribute[key])
attr.order = i
if attribute['disabled']:
# don't actively remove attribute, just make sure it never
# gets displayed