settings: Reorder custom profile field types.

This commit alphabetizes the custom profile field types in the
settings UI.

Fixes #28511.
This commit is contained in:
ColeBurch 2024-01-21 11:12:14 -07:00 committed by Tim Abbott
parent 9917ffa220
commit 60225591dc
2 changed files with 7 additions and 5 deletions

View File

@ -14,13 +14,13 @@ class Migration(migrations.Migration):
name="field_type", name="field_type",
field=models.PositiveSmallIntegerField( field=models.PositiveSmallIntegerField(
choices=[ choices=[
(1, "Text (short)"),
(2, "Text (long)"),
(4, "Date"), (4, "Date"),
(5, "Link"),
(7, "External account"), (7, "External account"),
(8, "Pronouns"), (5, "Link"),
(3, "List of options"), (3, "List of options"),
(8, "Pronouns"),
(2, "Text (long)"),
(1, "Text (short)"),
(6, "Users"), (6, "Users"),
], ],
default=1, default=1,

View File

@ -120,7 +120,9 @@ class CustomProfileField(models.Model):
(PRONOUNS, gettext_lazy("Pronouns"), check_short_string, str, "PRONOUNS"), (PRONOUNS, gettext_lazy("Pronouns"), check_short_string, str, "PRONOUNS"),
] ]
ALL_FIELD_TYPES = [*FIELD_TYPE_DATA, *SELECT_FIELD_TYPE_DATA, *USER_FIELD_TYPE_DATA] ALL_FIELD_TYPES = sorted(
[*FIELD_TYPE_DATA, *SELECT_FIELD_TYPE_DATA, *USER_FIELD_TYPE_DATA], key=lambda x: x[1]
)
FIELD_VALIDATORS: Dict[int, Validator[ProfileDataElementValue]] = { FIELD_VALIDATORS: Dict[int, Validator[ProfileDataElementValue]] = {
item[0]: item[2] for item in FIELD_TYPE_DATA item[0]: item[2] for item in FIELD_TYPE_DATA