Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Hidden __pycache__ dirs for FilePathField. Refs #17393.

This will be tested as soon as tests will run under Python 3. Patch
taken from Vinay Sajip's Python 3 branch.
  • Loading branch information...
commit eb0140bddca4d25be2bf02144f43b1b12b0cbed3 1 parent aa757ac
@claudep claudep authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 django/forms/fields.py
View
4 django/forms/fields.py
@@ -932,12 +932,16 @@ def __init__(self, path, match=None, recursive=False, allow_files=True,
self.choices.append((f, f.replace(path, "", 1)))
if self.allow_folders:
for f in dirs:
+ if f == '__pycache__':
+ continue
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)))
else:
try:
for f in sorted(os.listdir(self.path)):
+ if f == '__pycache__':
+ continue
full_file = os.path.join(self.path, f)
if (((self.allow_files and os.path.isfile(full_file)) or
(self.allow_folders and os.path.isdir(full_file))) and
Please sign in to comment.
Something went wrong with that request. Please try again.