示例#1
0
 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
示例#2
0
    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
示例#3
0
 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
示例#4
0
 def __init__(self, *args, **kwargs):
     FileFieldRenderer.__init__(self, *args, **kwargs)
     self._path = None