Просмотр исходного кода

sort invalid names alphabetically

Rafał Pitoń 8 лет назад
Родитель
Сommit
eaa363e126
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      misago/threads/api/postingendpoint/participants.py

+ 3 - 1
misago/threads/api/postingendpoint/participants.py

@@ -78,8 +78,10 @@ class ParticipantsSerializer(serializers.Serializer):
 
         if len(usernames) != len(users):
             invalid_usernames = set(usernames) - set([u.slug for u in users])
+            sorted_usernames = sorted(invalid_usernames)
+
             message = _("One or more users could not be found: %(usernames)s")
             raise serializers.ValidationError(
-                message % {'usernames': ', '.join(invalid_usernames)})
+                message % {'usernames': ', '.join(sorted_usernames)})
 
         return users