Django

Code

Changeset 3146

Show
Ignore:
Timestamp:
06/19/06 07:30:43 (2 years ago)
Author:
mtredinnick
Message:

Fixed #1756 -- Permit selecting no file in a FilePathField? with blank = True.
Thanks to Adam Endicott for the patch.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/forms/__init__.py

    r3113 r3146  
    899899    def __init__(self, field_name, path, match=None, recursive=False, is_required=False, validator_list=None): 
    900900        import os 
     901        from django.db.models import BLANK_CHOICE_DASH 
    901902        if match is not None: 
    902903            import re 
    903904            match_re = re.compile(match) 
    904         choices = [] 
     905        choices = not is_required and BLANK_CHOICE_DASH[:] or [] 
    905906        if recursive: 
    906907            for root, dirs, files in os.walk(path):