Opened 8 years ago
Closed 8 years ago
#28264 closed Cleanup/optimization (fixed)
forms.FilePathField does not return sorted subdirectories in formfield
| Reported by: | Jean-Marie Thomas | Owned by: | Srinivas Reddy Thatiparthy |
|---|---|---|---|
| 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 (last modified by )
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__':
Attachments (1)
Change History (5)
by , 8 years ago
| Attachment: | fields.diff added |
|---|
comment:1 by , 8 years ago
| Description: | modified (diff) |
|---|---|
| Needs tests: | set |
| Summary: | django.forms.FilePathField does not return sorted subdirectories in formfield → forms.FilePathField does not return sorted subdirectories in formfield |
| Triage Stage: | Unreviewed → Accepted |
| Type: | Uncategorized → Cleanup/optimization |
Could you also add a test and send a pull request on GitHub?
comment:2 by , 8 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
Note:
See TracTickets
for help on using tickets.
Two lines of diff