mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #28264 -- Made FilePathField sort files and directories when recursive=True.
This commit is contained in:
committed by
Tim Graham
parent
99e7bba443
commit
b306c0c1a3
@@ -1083,12 +1083,12 @@ class FilePathField(ChoiceField):
|
||||
if recursive:
|
||||
for root, dirs, files in sorted(os.walk(self.path)):
|
||||
if self.allow_files:
|
||||
for f in files:
|
||||
for f in sorted(files):
|
||||
if self.match is None or self.match_re.search(f):
|
||||
f = os.path.join(root, f)
|
||||
self.choices.append((f, f.replace(path, "", 1)))
|
||||
if self.allow_folders:
|
||||
for f in dirs:
|
||||
for f in sorted(dirs):
|
||||
if f == '__pycache__':
|
||||
continue
|
||||
if self.match is None or self.match_re.search(f):
|
||||
|
||||
Reference in New Issue
Block a user