Ticket #5894: diff.2.diff

File diff.2.diff, 1.1 KB (added by Alex Gaynor, 17 years ago)

Here is the admin field

  • django/db/models/fields/__init__.py

     
    812812class FilePathField(Field):
    813813    def __init__(self, verbose_name=None, name=None, path='', match=None, recursive=False, **kwargs):
    814814        self.path, self.match, self.recursive = path, match, recursive
    815         kwargs['max_length'] = kwargs.get('max_length', 100)
    816815        Field.__init__(self, verbose_name, name, **kwargs)
     816
     817    def formfield(self, **kwargs):
     818        defaults = {
     819            'path': self.path,
     820            'match': self.match,
     821            'recursive': self.recursive,
     822            'form_class': forms.FilePathField,
     823        }
     824        defaults.update(kwargs)
     825        return super(FilePathField, self).formfield(**defaults)
    817826
    818     def get_manipulator_field_objs(self):
    819         return [curry(oldforms.FilePathField, path=self.path, match=self.match, recursive=self.recursive)]
    820 
    821827class FloatField(Field):
    822828    empty_strings_allowed = False
Back to Top