core.files.storage.Storage.generate_filename()

generate_filename(filename) [source]

New in Django 1.10.

Validates the filename by calling get_valid_name() and returns a filename to be passed to the save() method.

The filename argument may include a path as returned by FileField.upload_to. In that case, the path won’t be passed to get_valid_name() but will be prepended back to the resulting name.

The default implementation uses os.path operations. Override this method if that’s not appropriate for your storage.

doc_Django
2016-10-09 18:34:46
Comments
Leave a Comment

Please login to continue.