Complete infoscreen video support

Closes issues #5 #7
This commit is contained in:
Joel Lavikainen
2017-05-24 16:44:59 +03:00
parent 7e2cf03ced
commit bec498bfee
10 changed files with 141 additions and 1 deletions
+20
View File
@@ -175,6 +175,21 @@ class ImageInfoItem(InfoItem):
d["options"] = {'img': self.img.url}
return d
class VideoInfoItem(InfoItem):
display_name = ("Video")
video = models.FileField(upload_to="infovideos/")
def get_template_url(self):
return "/static/html/generic_video.html?video={}".format(self.name)
@staticmethod
def get_create_template_url():
return "/static/html/generic_video_create.html"
def get_dict(self):
d = super().get_dict()
d["options"] = {'video': self.video.url}
return d
class HslInfoItem(InfoItem):
display_name = _("HSL timetables")
@@ -298,6 +313,11 @@ class ImageUploadForm(forms.Form):
name = forms.CharField()
image = forms.ImageField()
class UploadFileForm(forms.Form):
name = forms.CharField()
video = forms.FileField()
class HSLDataModel(models.Model):
data = models.TextField(default="", editable=False)