Preserve the ordering

set made no guarantees about ordering
This commit is contained in:
tcely authored and GitHub committed 2025-02-03 09:16:26 -05:00
1 parent bdfd645097
commit 4a5660be8d
1 file changed
+2 -1
+2 -1
View File
@@ -180,7 +180,8 @@ class CommaSepChoiceField(models.CharField):
return '' return ''
if data.all_choice in value: if data.all_choice in value:
return data.all_choice return data.all_choice
return data.separator.join(set(reversed(value))) ordered_unique = list(dict.fromkeys(value))
return data.separator.join(ordered_unique)
# extra functions not used by any parent classes # extra functions not used by any parent classes
def get_all_choices(self): def get_all_choices(self):