diff --git a/infoscreen/migrations/0007_sossoinfoitem.py b/infoscreen/migrations/0007_sossoinfoitem.py new file mode 100644 index 0000000..d2ffd84 --- /dev/null +++ b/infoscreen/migrations/0007_sossoinfoitem.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-09-27 18:06 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('infoscreen', '0006_abbinfoitem_externalimageinfoitem_imageinfoitem_infoinstance_infoitem'), + ] + + operations = [ + migrations.CreateModel( + name='SossoInfoItem', + fields=[ + ('infoitem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='infoscreen.InfoItem')), + ], + bases=('infoscreen.infoitem',), + ), + ] diff --git a/infoscreen/models.py b/infoscreen/models.py index f459318..6768560 100644 --- a/infoscreen/models.py +++ b/infoscreen/models.py @@ -72,6 +72,13 @@ class ABBInfoItem(InfoItem): def get_create_template_url(): return "/static/html/abb_create.html" +class SossoInfoItem(InfoItem): + def get_template_url(self): + return "/static/html/sosso.html" + @staticmethod + def get_create_template_url(): + return "/static/html/sosso_create.html" + class ImageInfoItem(InfoItem): img = models.ImageField(upload_to="infoimages/") diff --git a/infoscreen/static/html/sosso.html b/infoscreen/static/html/sosso.html new file mode 100644 index 0000000..a5dea0a --- /dev/null +++ b/infoscreen/static/html/sosso.html @@ -0,0 +1,19 @@ +
+
+
+
JUTUT
+
+ +
+
+
+
+

{{ post.title }}

+
+
{{ post.author.first_name }} {{ post.author.last_name }}
+
{{ post.date }}
+
+
+
+
+
diff --git a/infoscreen/static/html/sosso_create.html b/infoscreen/static/html/sosso_create.html new file mode 100644 index 0000000..78570c1 --- /dev/null +++ b/infoscreen/static/html/sosso_create.html @@ -0,0 +1,7 @@ +
+
+ + +
+ +
diff --git a/infoscreen/static/js/infoadmin_controllers.js b/infoscreen/static/js/infoadmin_controllers.js index 2fcbf6d..2046c68 100644 --- a/infoscreen/static/js/infoadmin_controllers.js +++ b/infoscreen/static/js/infoadmin_controllers.js @@ -106,6 +106,12 @@ app.controller('infoadmin_abbitem_create', function($scope, $http,ItemList){ $http.post("/infoscreen/create_abbitem", $scope.item).then(ItemList.loadItems) } }); +app.controller('infoadmin_sossoitem_create', function($scope, $http,ItemList){ + $scope.item = {} + $scope.send = function(){ + $http.post("/infoscreen/create_sossoitem", $scope.item).then(ItemList.loadItems) + } +}); app.controller('infoadmin_image_create', ['$scope', 'Upload', '$timeout',"ItemList", function ($scope, Upload, $timeout,ItemList) { $scope.send = function(file) { diff --git a/infoscreen/static/js/infoscreen_controllers.js b/infoscreen/static/js/infoscreen_controllers.js index 259abf0..75e2493 100644 --- a/infoscreen/static/js/infoscreen_controllers.js +++ b/infoscreen/static/js/infoscreen_controllers.js @@ -39,6 +39,13 @@ app.controller('ABBController', function($scope, $http){ $scope.jobs = response.data; }) }); +app.controller('SossoController', function($scope, $http){ + $scope.data = []; + $http.get("http://sosso.fi/api/get_recent_posts/?count=" + 3 ).then(function(response) + { + $scope.data = response.data; + }) +}); app.controller('timetableCtrl', function($scope, $http, $interval) { function load(){ diff --git a/infoscreen/views.py b/infoscreen/views.py index c338453..f1343ec 100644 --- a/infoscreen/views.py +++ b/infoscreen/views.py @@ -7,7 +7,7 @@ from django.contrib.auth.decorators import permission_required from django.utils import timezone from infoscreen.models import ABBJob, Rotation, InfoItem, InfoInstance -from infoscreen.models import ABBInfoItem, ExternalImageInfoItem, ImageInfoItem +from infoscreen.models import ABBInfoItem, ExternalImageInfoItem, ImageInfoItem, SossoInfoItem from infoscreen.models import ImageUploadForm from datetime import datetime, timedelta @@ -146,4 +146,5 @@ def createImageItem(request, *args, **kwargs): createInstance = itemCreator(InfoInstance) deleteInstance = itemDeletor(InfoInstance) createABBItem = itemCreator(ABBInfoItem) +createSossoItem = itemCreator(SossoInfoItem) createExternalImageInfoItem = itemCreator(ExternalImageInfoItem) diff --git a/sikweb/urls.py b/sikweb/urls.py index 3d42b13..17c3ca8 100644 --- a/sikweb/urls.py +++ b/sikweb/urls.py @@ -43,6 +43,7 @@ from infoscreen.views import deleteInstance as deleteInfoInstance from infoscreen.views import createExternalImageInfoItem from infoscreen.views import createImageItem from infoscreen.views import createABBItem +from infoscreen.views import createSossoItem from infoscreen.views import admin as infoscreen_admin #application from members.views import applicationindex @@ -78,6 +79,7 @@ urlpatterns = [ url(r'^infoscreen/create_external_image$', createExternalImageInfoItem), url(r'^infoscreen/create_image$', createImageItem), url(r'^infoscreen/create_abbitem$', createABBItem), + url(r'^infoscreen/create_sossoitem$', createSossoItem), url(r'^infoscreen/admin$', infoscreen_admin), #application url(r'^application/$', applicationindex),