Preserve the ordering
set made no guarantees about ordering
This commit is contained in:
1 parent
bdfd645097
commit
4a5660be8d
1 file changed
+2
-1
@@ -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):
|
||||||
|
|||||||
Reference in new issue
Block a user