Changes between Initial Version and Version 1 of Ticket #28264


Ignore:
Timestamp:
06/01/17 17:07:19 (5 years ago)
Author:
Tim Graham
Comment:

Could you also add a test and send a pull request on GitHub?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28264

    • Property Triage Stage changed from Unreviewed to Accepted
    • Property Type changed from Uncategorized to Cleanup/optimization
    • Property Needs tests set
    • Property Summary changed from django.forms.FilePathField does not return sorted subdirectories in formfield to forms.FilePathField does not return sorted subdirectories in formfield
  • Ticket #28264 – Description

    initial v1  
    11In the code :
    2 
    3             for root, dirs, files in sorted(os.walk(self.path)):
    4                 if self.allow_files:
     2{{{
     3for root, dirs, files in sorted(os.walk(self.path)):
     4    if self.allow_files:
    55# here, files are not sorted
    6                     for f in files:
    7                         if self.match is None or self.match_re.search(f):
    8                             f = os.path.join(root, f)
    9                             self.choices.append((f, f.replace(path, "", 1)))
    10                 if self.allow_folders:
     6        for f in files:
     7            if self.match is None or self.match_re.search(f):
     8                f = os.path.join(root, f)
     9                self.choices.append((f, f.replace(path, "", 1)))
     10    if self.allow_folders:
    1111# and here, dirs are not sorted
    12                     for f in dirs:
    13                         if f == '__pycache__':
     12        for f in dirs:
     13            if f == '__pycache__':
     14}}}
Back to Top