Ticket #8217: FilePathField-sorted.diff
File FilePathField-sorted.diff, 1.0 KB (added by , 16 years ago) |
---|
-
django/forms/fields.py
782 782 if self.match is not None: 783 783 self.match_re = re.compile(self.match) 784 784 if recursive: 785 for root, dirs, files in os.walk(self.path):785 for root, dirs, files in sorted(os.walk(self.path)): 786 786 for f in files: 787 787 if self.match is None or self.match_re.search(f): 788 788 f = os.path.join(root, f) 789 789 self.choices.append((f, f.replace(path, "", 1))) 790 790 else: 791 791 try: 792 for f in os.listdir(self.path):792 for f in sorted(os.listdir(self.path)): 793 793 full_file = os.path.join(self.path, f) 794 794 if os.path.isfile(full_file) and (self.match is None or self.match_re.search(f)): 795 795 self.choices.append((full_file, f))