def __init__(self, *args, **kwargs): if not self.storage_path or not os.path.isdir(self.storage_path): raise ValueError( 'storage_path must be set to a valid path. Got %r' % self.storage_path) Base.__init__(self, *args, **kwargs) self._path = None
def render(self, **kwargs): """render a file field and the file preview """ html = Base.render(self, **kwargs) value = self.field.value if value: html += self.render_readonly() # add the old value for objects not yet stored old_value = '%s--old' % self.name html += h.hidden_field(old_value, value=value) return html
def __init__(self, *args, **kwargs): FileFieldRenderer.__init__(self, *args, **kwargs) self._path = None