Ticket #1756: patch.diff

File patch.diff, 749 bytes (added by Adam Endicott, 19 years ago)
  • django/forms/__init__.py

     
    871871    "A SelectField whose choices are the files in a given directory."
    872872    def __init__(self, field_name, path, match=None, recursive=False, is_required=False, validator_list=[]):
    873873        import os
     874        from django.db import models
    874875        if match is not None:
    875876            import re
    876877            match_re = re.compile(match)
    877         choices = []
     878        choices = not is_required and models.BLANK_CHOICE_DASH[:] or []
    878879        if recursive:
    879880            for root, dirs, files in os.walk(path):
    880881                for f in files:
Back to Top