Browse files

Fixed #8217 -- Correctly sort files in FilePathFields on older Pytho…

…n versions. Thanks, bernd and davidb.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
jezdez committed Dec 2, 2010
1 parent 7421f72 commit fb391b8b98e9e6a3dc89cfb43892f96cf70d199c
Showing with 2 additions and 2 deletions.
  1. +2 −2 django/forms/
@@ -867,14 +867,14 @@ def __init__(self, path, match=None, recursive=False, required=True,
self.match_re = re.compile(self.match)
if recursive:
- for root, dirs, files in os.walk(self.path):
+ for root, dirs, files in sorted(os.walk(self.path)):
for f in files:
if self.match is None or
f = os.path.join(root, f)
self.choices.append((f, f.replace(path, "", 1)))
- for f in os.listdir(self.path):
+ for f in sorted(os.listdir(self.path)):
full_file = os.path.join(self.path, f)
if os.path.isfile(full_file) and (self.match is None or
self.choices.append((full_file, f))

0 comments on commit fb391b8

Please sign in to comment.