customStorage manager in Sistemas app and zip views to upload the zip

This commit is contained in:
fjrodriguez
2023-02-10 07:39:25 -06:00
parent b73a4d50d0
commit ddc4be05a2
6 changed files with 120 additions and 11 deletions

18
Sistemas/customStorage.py Normal file
View File

@@ -0,0 +1,18 @@
from django.core.files.storage import FileSystemStorage
import os
class CustomStorage(FileSystemStorage):
def __init__(self, location):
self.location=location
super(CustomStorage,self).__init__(location=location, base_url=None)
def save(self, name, content):
if self.exists(name):
self.delete(name)
return super()._save(name,content)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
download_system_dir = os.path.join(BASE_DIR,'downloadSystems')
custom_stoarge = CustomStorage(location=download_system_dir)