0.5.10 documentation insert video, file storage
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
from django.db import models
|
||||
from BaseModels.base_models import *
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
@@ -8,6 +9,12 @@ from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.contenttypes.fields import GenericRelation
|
||||
from colorfield.fields import ColorField
|
||||
from filebrowser.fields import FileBrowseField
|
||||
from filebrowser.base import FileObject
|
||||
|
||||
class FileUnit(BaseModel):
|
||||
file = FileBrowseField(verbose_name=_('Файл'), max_length=250, directory="files/")
|
||||
|
||||
|
||||
class StaticPage(BaseModelViewPage):
|
||||
promo_header = models.BooleanField(verbose_name='Промо-хэдер', default=False)
|
||||
@@ -120,6 +127,11 @@ class WidgetForBlock(BaseModel):
|
||||
validators=[validate_file_extension]
|
||||
)
|
||||
|
||||
def image(self):
|
||||
if self.picture:
|
||||
return FileObject(self.picture.path)
|
||||
return None
|
||||
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Виджет в блоке')
|
||||
|
||||
Reference in New Issue
Block a user