Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #1756 -- Permit selecting no file in a FilePathField with blank…

… = True.

Thanks to Adam Endicott for the patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3146 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 271083cf7c63155ae7221e63e6d198acbbe802e5 1 parent 1fc3b32
Malcolm Tredinnick authored June 19, 2006

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  django/forms/__init__.py
3  django/forms/__init__.py
@@ -898,10 +898,11 @@ class FilePathField(SelectField):
898 898
     "A SelectField whose choices are the files in a given directory."
899 899
     def __init__(self, field_name, path, match=None, recursive=False, is_required=False, validator_list=None):
900 900
         import os
  901
+        from django.db.models import BLANK_CHOICE_DASH
901 902
         if match is not None:
902 903
             import re
903 904
             match_re = re.compile(match)
904  
-        choices = []
  905
+        choices = not is_required and BLANK_CHOICE_DASH[:] or []
905 906
         if recursive:
906 907
             for root, dirs, files in os.walk(path):
907 908
                 for f in files:

0 notes on commit 271083c

Please sign in to comment.
Something went wrong with that request. Please try again.