Commit 3cbef184 authored by sheryl's avatar sheryl
Browse files
parents 63b044ca 9e4130a6
Pipeline #171607 passed with stages
in 2 minutes and 8 seconds
......@@ -10,20 +10,20 @@ from django.contrib.auth import get_user_model
from django.core.validators import MinValueValidator
# class OverwriteStorage(FileSystemStorage):
# """Filesystem storage for overwriting files. Currently unused."""
# def get_available_name(self, name, max_length=None):
# """https://djangosnippets.org/snippets/976/
# Returns a filename that's free on the target storage system, and
# available for new content to be written to.
# Args:
# name (str): Name of the file
# max_length (int, optional): Maximum length of a file name. Defaults to None.
# """
# if self.exists(name):
# os.remove(os.path.join(settings.MEDIA_ROOT, name))
class OverwriteStorage(FileSystemStorage):
"""Filesystem storage for overwriting files. Currently unused."""
def get_available_name(self, name, max_length=None):
"""https://djangosnippets.org/snippets/976/
Returns a filename that's free on the target storage system, and
available for new content to be written to.
Args:
name (str): Name of the file
max_length (int, optional): Maximum length of a file name. Defaults to None.
"""
if self.exists(name):
os.remove(os.path.join(settings.MEDIA_ROOT, name))
# Create your models here.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment