-
Notifications
You must be signed in to change notification settings - Fork 239
Expand file tree
/
Copy pathmodels.py
More file actions
37 lines (29 loc) · 940 Bytes
/
models.py
File metadata and controls
37 lines (29 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
Simple file inclusion content: You should probably use the media library
instead.
"""
import os
from django.db import models
from django.utils.translation import gettext_lazy as _
from feincms import settings
from feincms.utils.tuple import AutoRenderTuple
class FileContent(models.Model):
# You should probably use
# `feincms.content.medialibrary.models.MediaFileContent` instead.
title = models.CharField(max_length=200)
file = models.FileField(
_("file"),
max_length=255,
upload_to=os.path.join(settings.FEINCMS_UPLOAD_PREFIX, "filecontent"),
)
class Meta:
abstract = True
verbose_name = _("file")
verbose_name_plural = _("files")
def render(self, **kwargs):
return AutoRenderTuple(
(
["content/file/%s.html" % self.region, "content/file/default.html"],
{"content": self},
)
)