Changes between Initial Version and Version 1 of Ticket #28264


Ignore:
Timestamp:
Jun 1, 2017, 12:07:19 PM (7 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 Needs tests set
    • Property Triage Stage UnreviewedAccepted
    • Property Summary django.forms.FilePathField does not return sorted subdirectories in formfieldforms.FilePathField does not return sorted subdirectories in formfield
    • Property Type UncategorizedCleanup/optimization
  • 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