Refs #29689 -- Moved FilePathField choices sorting outside the loop.

This commit is contained in:
Sergey Fedoseev 2018-08-29 15:19:32 +05:00 committed by Tim Graham
parent 39461a83c3
commit 54b331451c
1 changed files with 1 additions and 1 deletions

View File

@ -1113,7 +1113,7 @@ class FilePathField(ChoiceField):
(self.allow_folders and f.is_dir())) and
(self.match is None or self.match_re.search(f.name))):
choices.append((f.path, f.name))
choices.sort(key=operator.itemgetter(1))
choices.sort(key=operator.itemgetter(1))
self.choices.extend(choices)
self.widget.choices = self.choices