Merge branch 'develop' into feature-videoitem

This commit is contained in:
Joel Lavikainen
2017-05-24 17:29:58 +03:00
135 changed files with 39590 additions and 6931 deletions
+17 -9
View File
@@ -1,11 +1,13 @@
from datetime import datetime
from django.db import models
from django import forms
from django.utils import timezone
from datetime import datetime
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext as _
class InfoItem(models.Model):
class __meta__:
@@ -73,27 +75,30 @@ class InfoItem(models.Model):
class ABBInfoItem(InfoItem):
display_name = _("ABB jobs")
def get_template_url(self):
return "/static/html/abb.html"
@staticmethod
def get_create_template_url():
return "/static/html/abb_create.html"
class ApyInfoItem(InfoItem):
display_name = _("APY Item")
def get_template_url(self):
return "/static/html/apy.html"
@staticmethod
def get_create_template_url():
return "/static/html/apy_create.html"
class ExternalWebsiteInfoItem(InfoItem):
display_name = _("External website")
url = models.TextField()
def get_template_url(self):
return "/static/html/external_website.html?url={}".format(self.name)
@@ -114,8 +119,8 @@ class ExternalWebsiteInfoItem(InfoItem):
def get_list(self):
return {
'id':self.id,
'name':self.name,
'id': self.id,
'name': self.name,
'url': self.url,
}
@@ -137,8 +142,10 @@ class ExternalWebsiteInfoItem(InfoItem):
pass
self.save()
class SossoInfoItem(InfoItem):
display_name = _("Sössö articles")
def get_template_url(self):
return "/static/html/sosso.html"
@@ -146,6 +153,7 @@ class SossoInfoItem(InfoItem):
def get_create_template_url():
return "/static/html/sosso_create.html"
class EventInfoItem(InfoItem):
display_name = _("Events")
@@ -157,7 +165,6 @@ class EventInfoItem(InfoItem):
return "/static/html/events_create.html"
class ImageInfoItem(InfoItem):
display_name = _("Image")
img = models.ImageField(upload_to="infoimages/")
@@ -193,6 +200,7 @@ class VideoInfoItem(InfoItem):
class HslInfoItem(InfoItem):
display_name = _("HSL timetables")
def get_template_url(self):
return "/static/html/hsl.html"
@@ -290,15 +298,15 @@ class Rotation(models.Model):
instance_list = list(map(lambda i: i.get_dict(), filtered))
return {
'id':self.id,
'id': self.id,
'name': self.name,
'instances': instance_list,
}
def get_list(self):
return {
'id':self.id,
'name':self.name,
'id': self.id,
'name': self.name,
}
def __str__(self):