Jonas Havelka
1 week ago
11 changed files with 44 additions and 58 deletions
@ -1,23 +0,0 @@ |
|||
from django.urls import reverse |
|||
from django.db import models |
|||
|
|||
|
|||
class SeminarModelBase(models.Model): |
|||
|
|||
class Meta: |
|||
abstract = True |
|||
|
|||
def verejne(self): |
|||
return False |
|||
|
|||
# def get_absolute_url(self): |
|||
# return "https://" + str(get_current_site(None)) + self.verejne_url() |
|||
|
|||
def admin_url(self): |
|||
app_name = self._meta.app_label |
|||
model_name = self._meta.model_name |
|||
return reverse('admin:{}_{}_change'.format(app_name, model_name), args=(self.id, )) |
|||
|
|||
# def verejne_url(self): |
|||
# return None |
|||
|
@ -1,14 +0,0 @@ |
|||
import os |
|||
import logging |
|||
|
|||
from django.core.files.storage import FileSystemStorage |
|||
|
|||
logger = logging.getLogger(__name__) |
|||
|
|||
class OverwriteStorage(FileSystemStorage): |
|||
""" Varianta FileSystemStorage, která v případě, že soubor cílového |
|||
jména již existuje, ho smaže a místo něj uloží soubor nový""" |
|||
def get_available_name(self,name, max_length=None): |
|||
if self.exists(name): |
|||
os.remove(os.path.join(self.location,name)) |
|||
return super().get_available_name(name,max_length) |
Loading…
Reference in new issue