Opened 7 years ago
Last modified 7 years ago
#28264 closed Cleanup/optimization
django.forms.FilePathField does not return sorted subdirectories in formfield — at Initial Version
Reported by: | Jean-Marie Thomas | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.11 |
Severity: | Normal | Keywords: | FilePathField |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
In the code :
for root, dirs, files in sorted(os.walk(self.path)):
if self.allow_files:
# here, files are not sorted
for f in 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:
# and here, dirs are not sorted
for f in dirs:
if f == 'pycache':
Note:
See TracTickets
for help on using tickets.
Two lines of diff