755 Commits

Author SHA1 Message Date
Aarni Halinen 44e63b6105 Fix tests 2022-10-24 21:46:08 +03:00
Aarni Halinen dae78ee976 Add tests 2022-10-24 21:43:29 +03:00
Aarni Halinen f813eaf9bf Update node to v16 in CI 2022-10-24 21:43:29 +03:00
Aarni Halinen 8baea20824 Add .nvmrc 2022-10-24 21:43:29 +03:00
Aarni Halinen 393ee997d9 Add delete path for SignupViewSet 2022-10-24 21:43:29 +03:00
Aarni Halinen f67ce55d60 Fix webapp test as module 2022-10-24 21:42:41 +03:00
Ojakoo 5e1390ab6b Changes to kaehmy categories 2022-10-05 14:18:28 +03:00
Ojakoo 99348dc297 Update dparse 2022-10-05 12:58:29 +03:00
Ojakoo 715b309c89 Added new categories for kaehmy 2022-10-05 12:43:52 +03:00
Ojakoo 70676d5203 Lint 2022-09-23 20:53:25 +03:00
Ojakoo 037e4ae6e8 Use html templates for kaehmy emails. No translations for now. 2022-09-23 20:30:08 +03:00
Ojakoo 8d6f13b61d Update privacy policy link 2022-09-23 17:57:36 +03:00
Ojakoo 03982ee620 Update kaehmy dates and change header to html instead of picture. 2022-09-23 17:51:01 +03:00
Ojakoo a8923b63d6 wrap private key 2022-09-13 13:31:58 +03:00
Ojakoo 19975877cb Remove debug stuff 2022-09-13 09:59:55 +03:00
Ojakoo 2e0fad4bb2 Use POSIX format for source 2022-09-12 22:42:01 +03:00
Ojakoo f0179c1840 Change google creds format. Ugly but works. 2022-09-12 22:38:18 +03:00
Ojakoo 37a9750d4d Add group key and dev secrets to stack compose 2022-09-05 13:38:26 +03:00
Ojakoo 5575186570 lint 2022-09-05 12:03:31 +03:00
Ojakoo 9e179d5e06 Added error handling for incorrectly formatted google creds 2022-09-05 10:40:29 +03:00
Ojakoo ea9a732803 Modified paths 2022-08-17 23:00:11 +03:00
Ojakoo 0026b788b2 juuh eli 2022-08-16 23:00:36 +03:00
Ojakoo da3a484f6c wbn? 2022-08-16 22:24:20 +03:00
Ojakoo a310d51f5e or not 2022-08-16 21:43:04 +03:00
Ojakoo 6732e30213 #14 fix paths 2022-08-16 21:26:55 +03:00
Ojakoo 4e59eee200 Enable GOOGLE_SERVICE_ACCOUNT, should work now.. 2022-08-16 20:59:19 +03:00
Aarni Halinen bb0b2a2628 Fix kaehmy form 2022-08-11 11:28:30 +03:00
Aarni Halinen 32d636d3ee Disable GOOGLE_SERVICE_ACCOUNT for debugging 2022-08-11 09:52:58 +03:00
Ojakoo c91b99cdb1 lol 2022-08-09 21:44:01 +03:00
Aarni Halinen ca73eba609 Revert "Install django-suit v2"
This reverts commit fe46d57108.
2022-08-06 16:26:15 +03:00
Aarni Halinen fe46d57108 Install django-suit v2 2022-08-06 16:02:58 +03:00
Ojakoo 70e1835a4f Update dependencies 2022-08-06 12:28:43 +03:00
Ojakoo b7f17671d9 Resolve conlict 2022-08-06 12:09:50 +03:00
Ojakoo 34659403a8 lint 2022-08-06 11:03:39 +03:00
Ojakoo 4fbf5fe0a4 Jas list error notification only in prod 2022-08-06 10:17:43 +03:00
Ojakoo c6be0e6562 Add google envs to deploy 2022-08-06 10:07:00 +03:00
Aarni Halinen 3623c7e9f4 Fix TG message template 2022-08-04 00:51:45 +03:00
Aarni Halinen 298db5b78e Merge branch 'remove-baserole' into 'develop'
Remove webapp BaseRole model

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!67
2022-08-03 20:44:55 +00:00
Aarni Halinen 1ca6de3090 Fix lint 2022-08-03 23:35:41 +03:00
Aarni Halinen 07d0f2aa47 Remove comment 2022-08-03 23:19:42 +03:00
Aarni Halinen 93e122b8a8 Remove webapp BaseRole 2022-08-03 23:19:40 +03:00
Aarni Halinen 9678b663a0 Update kaehmy BaseRole 2022-08-03 23:18:32 +03:00
Aarni Halinen 992a2ec8e0 Add new BaseRole 2022-08-03 23:15:12 +03:00
Aarni Halinen b41bd41a54 Fix typo 2022-08-03 23:11:49 +03:00
Aarni Halinen 30f59c36fb Clean-up templates 2022-08-03 22:57:19 +03:00
Aarni Halinen f51d71e045 Fix most of html templates 2022-08-03 22:46:14 +03:00
Ojakoo 9c66238b82 Remove old json route 2022-08-03 00:34:42 +03:00
Ilari Ojakorpi 2f0143a9ae Merge branch 'update-django' into 'develop'
Update Django

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!68
2022-08-02 21:31:05 +00:00
Ojakoo 45ff2c3757 Format datetime to local timezone 2022-08-03 00:20:23 +03:00
Aarni Halinen 321d45b628 Fix unit tests 2022-08-01 22:31:47 +03:00
Aarni Halinen 2628d753f5 Fix JSONField deprecation warning 2022-08-01 22:22:30 +03:00
Aarni Halinen a603e2dff8 Add explicit primary keys 2022-08-01 22:22:02 +03:00
Aarni Halinen 96e05d908d Fix static files 2022-08-01 22:00:12 +03:00
Aarni Halinen a5bf5668eb Remove django-suit 2022-08-01 21:50:07 +03:00
Aarni Halinen 1ec5082faf Update Django packages 2022-08-01 21:33:31 +03:00
Aarni Halinen 6da5b97e19 Remove template tags removed in Django v3 2022-08-01 21:30:17 +03:00
Aarni Halinen 7fd30e3eba Update DB settings for Django v3 2022-08-01 21:24:10 +03:00
Aarni Halinen 3e9084ca1d Update jsonschema 2022-08-01 21:16:56 +03:00
Aarni Halinen a28f82d31e Update whitenoise 2022-08-01 21:15:08 +03:00
Aarni Halinen 04ecb8fc7e Update requests 2022-08-01 21:14:47 +03:00
Aarni Halinen 3e707e58a5 Run poetry update 2022-08-01 21:12:17 +03:00
Aarni Halinen 70d7f55996 Remove nose test runner 2022-08-01 21:09:17 +03:00
Aarni Halinen e408809e58 Update dev tools 2022-08-01 21:02:15 +03:00
Ojakoo 33fd4012f1 #13 fixed homepage link 2022-08-01 00:24:34 +03:00
Ojakoo 228938b695 lint 2022-07-31 16:33:28 +03:00
Ojakoo 72e91e3d62 Moved google creds to .env 2022-07-31 16:28:57 +03:00
Ojakoo 3f6a719e9d Added error handling, send email to user if adding fails 2022-07-31 11:12:51 +03:00
Aarni Halinen 490b99a848 Fix schema type 2022-07-28 22:13:01 +03:00
Aarni Halinen 0a899f5600 Fix schema 2022-07-28 21:45:48 +03:00
Aarni Halinen 7825cc7293 Add form validation on update 2022-07-28 21:16:22 +03:00
Aarni Halinen 8bb6e9e9a7 Add input validation schema for SignupFormViewSet create 2022-07-28 21:13:09 +03:00
Ojakoo 53c3acd39f directory api working state 2022-07-25 20:12:32 +03:00
Aarni Halinen dd0254a08e fix try-catch for jwt verification 2022-07-24 21:02:35 +03:00
Aarni Halinen 9b53fb4bc0 use jwt_access cookie in Filebrowser auth 2022-07-24 20:53:21 +03:00
Aarni Halinen e17c3ad92c Add --without-hashes to poetry export in Dockerfile 2022-07-22 01:08:36 +03:00
Aarni Halinen 362d981532 Disable pip dependency resolver in Dockerfile (handled by poetry) 2022-07-22 00:55:19 +03:00
Aarni Halinen e12be3c2f6 Revert "Add --without-hashes to poetry export in Dockerfile"
This reverts commit 3edae7f967.
2022-07-22 00:54:38 +03:00
Aarni Halinen 3edae7f967 Add --without-hashes to poetry export in Dockerfile 2022-07-22 00:52:04 +03:00
Aarni Halinen 4d159b2793 Add algorithms for FileBrowser JWT verification 2022-07-22 00:13:37 +03:00
Aarni Halinen cb3b831f7a Use husky for pre-commit hook 2022-07-21 23:47:56 +03:00
Aarni Halinen acba330694 Update CORS setting 2022-07-21 23:37:32 +03:00
Aarni Halinen eb22368055 Cleanup settings 2022-07-21 23:28:06 +03:00
Ojakoo fac2f9b367 Added pre-commit linter, lint 2022-07-04 10:33:38 +03:00
Ojakoo 7319c32d73 lint 2022-07-04 10:24:53 +03:00
Ojakoo b3a484ce55 Added verify path 2022-07-04 10:19:40 +03:00
Ojakoo 337b774074 lint 2022-06-21 21:47:54 +03:00
Ojakoo e70e598c57 #12 Changed djangorestframework-jwt to djangorestframework-simplejwt 2022-06-21 21:35:59 +03:00
Ojakoo 5eef2f685c Update pyjwt 2022-06-20 22:17:29 +03:00
Ojakoo d1953ef24c Changed application accept email formatting to html 2022-06-20 16:44:06 +03:00
Ojakoo ec4317d9e7 heevi email fix 2022-05-25 19:13:16 +03:00
Ojakoo cff84816fc Updated member application email links 2022-05-23 01:53:05 +03:00
Ojakoo 7881a24eb1 Updated heevi email message 2022-05-23 01:52:30 +03:00
Aarni Halinen a0765ca18b Merge branch 'python-dotenv' into 'develop'
Python dotenv

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!56
2022-05-19 19:23:14 +00:00
Aarni Halinen 913eb1cedf load .env file 2022-05-19 22:19:07 +03:00
Aarni Halinen 7035ebccca install python-dotenv 2022-05-19 22:18:50 +03:00
Aarni Halinen 2031146fc7 Merge branch 'add-dockerignore' into 'develop'
Add dockerignore file

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!59
2022-05-19 19:15:11 +00:00
Aarni Halinen 35f30300b3 Merge branch 'remove-about-page' into 'develop'
Remove about page

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!58
2022-05-19 19:13:58 +00:00
Aarni Halinen 342f2862a5 force empty logs and media folders 2022-05-19 22:11:36 +03:00
Aarni Halinen 3536ca5922 add dockerignore 2022-05-19 22:11:36 +03:00
Aarni Halinen 50ab7bc1f9 remove dealer 2022-05-19 22:09:47 +03:00
Aarni Halinen 102d8f82d6 remove about page 2022-05-19 22:08:18 +03:00
Aarni Halinen f302c0a17d Merge branch 'fix-audit' into 'develop'
Fix audit

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!57
2022-05-19 18:52:17 +00:00
Aarni Halinen a2b7086e9a update poetry to 1.1.13 2022-05-19 21:44:15 +03:00
Aarni Halinen 704652c643 update linter 2022-05-19 21:37:54 +03:00
Aarni Halinen 8741f6b113 update Pillow 2022-05-19 21:33:19 +03:00
Aarni Halinen 9ffb79aa52 poetry update 2022-05-19 21:32:37 +03:00
Ojakoo a2551cc110 Changed heevi banner 2022-05-19 15:44:32 +03:00
Aarni Halinen 8d7bd7067e remove TG_BOT_TOKEN 2022-01-14 00:14:32 +02:00
Aarni Halinen db3e3ae291 remove TG_BOT_TOKEN 2022-01-14 00:14:13 +02:00
Aarni Halinen 1afd476c18 fix lint 2022-01-13 23:37:17 +02:00
Aarni Halinen 322cc9d6fb add missing migration 2022-01-13 23:31:06 +02:00
Aarni Halinen 5f9a7a6994 poetry update 2022-01-13 23:25:14 +02:00
Aarni Halinen 3809ba9726 Merge branch 'feature/webhooks' into 'develop'
Feature: Webhooks

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!53
2022-01-13 21:10:42 +00:00
Aarni Halinen 79cc0bcd55 fix lint 2022-01-13 23:07:11 +02:00
Aarni Halinen 7cb03d40d4 fix ci 2022-01-13 23:02:57 +02:00
Aarni Halinen 34faf53347 Merge branch 'develop' into feature/webhooks 2022-01-13 22:58:10 +02:00
Aarni Halinen 8d2a26a9d1 Merge branch 'chore/black' into 'develop'
Chore: Add black as formatter

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!54
2022-01-13 20:55:55 +00:00
Aarni Halinen a05edb73d3 fix ci 2022-01-13 22:51:42 +02:00
Aarni Halinen 2c69e1b945 rename README 2022-01-13 22:39:52 +02:00
Aarni Halinen 9cae6ea890 update readme 2022-01-13 22:38:50 +02:00
Aarni Halinen 49a3b1449e fix ci 2022-01-13 22:38:40 +02:00
Aarni Halinen 02634c8e02 Merge branch 'develop' into feature/webhooks 2022-01-13 22:18:59 +02:00
Aarni Halinen 11efcdd579 format files with black 2022-01-13 22:10:51 +02:00
Aarni Halinen a0f062c697 replace pycodestyle with black 2022-01-13 22:10:44 +02:00
Aarni Halinen 1dc5d45e96 Fix ohlhafv email 2022-01-13 21:55:54 +02:00
Aarni Halinen 7382c4e4bf update send email uses 2022-01-13 21:53:55 +02:00
Aarni Halinen 867996ae27 fix lint 2022-01-13 21:00:42 +02:00
Aarni Halinen 798c860091 Add on save hooks for events, feed and jobads 2022-01-13 01:41:26 +02:00
Aarni Halinen 86a65e4680 Locale changes 2022-01-13 00:08:12 +02:00
Aarni Halinen 4a530826a8 Rewrite TG integration, support for other webhooks 2022-01-13 00:05:02 +02:00
Aarni Halinen 6f316401f7 Run poetry update 2022-01-12 21:13:24 +02:00
Aarni Halinen 8a8820be2f remove sentry tracing 2021-12-03 02:15:31 +02:00
Aarni Halinen 51278fd8bc try without special character 2021-11-17 20:14:35 +02:00
Aarni Halinen 2d86d548a3 update sendgrid code 2021-11-17 19:59:27 +02:00
Aarni Halinen 6380d39afb disable sentry performance monitoring 2021-11-17 19:23:28 +02:00
Toni Lyttinen 9420b1fd05 refactor: use jpg for banner 2021-11-17 16:13:09 +00:00
Toni Lyttinen fcd23c07ab "refactor": change banner to jpeg 2021-11-17 16:11:14 +00:00
Toni Lyttinen c92193057c style: change nav color 2021-11-17 15:41:57 +00:00
Toni Lyttinen a845be5394 fix: update header image src path 2021-11-17 15:25:59 +00:00
Oskari Ponkala c4a0f5a0ea change file ending 2021-11-17 15:16:57 +00:00
Oskari Ponkala 14735d8898 Replace heevit.svg 2021-11-17 15:13:38 +00:00
Oskari Ponkala d8250c691c update heevit 2021-11-17 14:59:57 +00:00
Toni Lyttinen 87d14240cf update 2021 heevi colors for banner 2021-11-17 14:56:55 +00:00
Aarni Halinen 50d4006b96 Merge branch 'sentry' into 'develop'
Feature: Sentry

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!48
2021-11-11 21:57:56 +00:00
Aarni Halinen d9b006904a unify string chars 2021-11-11 23:38:43 +02:00
Aarni Halinen 3aa225f3cd setup environment variables 2021-11-11 23:31:30 +02:00
Aarni Halinen a4e1aa5032 install sentry 2021-11-11 23:28:34 +02:00
Aarni Halinen 912ce44513 Update packages 2021-10-04 12:42:51 +03:00
Oskari Ponkala 6d093af511 Replace kaehmy_banner.png with updated dates 2021-10-04 06:49:09 +00:00
Oskari Ponkala be7a5fe2e2 Update kaehmy.html, update kähmy dates 2021-10-04 06:48:35 +00:00
Oskari Ponkala 40f6558a6e Update kaehmy.html 2021-10-04 06:47:29 +00:00
Toni Lyttinen 808c27e104 Merge branch 'feature/template-questions' into 'develop'
Feature: Signupform template questions API

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!46
2021-09-20 22:27:11 +00:00
Aarni Halinen b8342ba66a finish template question API 2021-08-24 02:50:46 +03:00
Aarni Halinen 9d05cd8290 poetry update 2021-08-23 19:37:08 +03:00
Aarni Halinen 4860c0a0d9 update npm deps 2021-06-15 22:58:33 +03:00
Oskari Ponkala 9d4c041153 Merge branch 'signups-fix' into 'develop'
Remove signup filtering by end time

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!44
2021-05-30 11:58:16 +00:00
Oskari Ponkala ce72ff7801 Remove signup filtering by end time 2021-05-30 11:53:45 +00:00
Aarni Halinen fb3328cb23 set DB on sslmode=require on prod 2021-05-16 18:42:58 +03:00
Aarni Halinen dac0fa1953 update production DB to Azure managed 2021-05-16 17:46:13 +03:00
Aarni Halinen 63672328f0 Merge branch 'feature/migrate-to-sendgrid' into 'develop'
Feature: Replace Mailjet with SendGrid

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!42
2021-05-16 14:30:07 +00:00
Aarni Halinen a927ab8a13 clean EMAIL_API_SECRETs 2021-05-16 17:24:13 +03:00
Aarni Halinen c6374d88b6 replace mailjet with sendgrid 2021-05-16 16:55:06 +03:00
Aarni Halinen f72017df01 Merge branch 'refactor/clean-deps' into 'develop'
Refactor: Use poetry for deps, update & audit dependencies

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!35
2021-05-08 16:21:24 +00:00
Aarni Halinen 26635bbbcc update metadata 2021-05-08 18:56:38 +03:00
Aarni Halinen 86973562ff update Django 2021-05-08 18:55:06 +03:00
Aarni Halinen 0c1bdba358 fix coverage report 2021-05-08 18:50:08 +03:00
Aarni Halinen 8481e963a3 update readme 2021-04-14 17:48:45 +03:00
Aarni Halinen 39ba51f11a Dockerfile from slim Debian image, remove poetry from server image 2021-04-14 17:33:50 +03:00
Aarni Halinen d889df951c install build-essential on Dockerfile 2021-04-14 17:20:15 +03:00
Aarni Halinen 19f8ff006c update gunicorn 2021-04-14 17:06:18 +03:00
Aarni Halinen ed77526f5c add audit step 2021-04-14 17:06:18 +03:00
Aarni Halinen 6f6dc09f01 install dev deps on test step 2021-04-14 17:06:18 +03:00
Aarni Halinen 5049ef415d update python to 3.9, fix gitlab-ci test step 2021-04-14 17:06:18 +03:00
Aarni Halinen 441227bc15 remove requirements.txt files 2021-04-14 17:06:18 +03:00
Aarni Halinen 78575075e5 update Dockerfile to use poetry 2021-04-14 17:06:18 +03:00
Aarni Halinen 4029031bf0 update django-cors-headers 2021-04-14 17:06:18 +03:00
Aarni Halinen f1ea08bc30 remove old files 2021-04-14 17:06:18 +03:00
Aarni Halinen e68f04117d update deps, Django v2.2 2021-04-14 17:06:18 +03:00
Aarni Halinen d07914bdb5 clean unused imports 2021-04-14 17:06:18 +03:00
Aarni Halinen 38eb4cd9cd clean dependencies 2021-04-14 17:06:18 +03:00
Aarni Halinen ab104d2acd Merge branch 'oskari.ponkala-develop-patch-58256' into 'develop'
Changed old vtmk emails to new admin email addresses and fixed an old link to old web

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!40
2021-04-14 14:05:39 +00:00
Oskari Ponkala 0376acdc9e Changed old vtmk emails to new admin email addresses and fixed an old link to old web 2021-04-08 12:10:24 +00:00
Oskari Ponkala abbf23456b Merge branch 'oskari.ponkala-develop-patch-49436' into 'develop'
Fixed news feed sorting

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!38
2021-04-08 10:03:23 +00:00
Oskari Ponkala 6a156dd9db Fixed news feed sorting 2021-04-08 09:59:40 +00:00
Aarni Halinen 9fb9bd447a remove throttling 2021-03-31 19:52:47 +03:00
Aarni Halinen ba69f54465 Revert "restart policy unless-stopped"
This reverts commit 9a450ea44a.
2021-03-31 00:02:54 +03:00
Aarni Halinen 9a450ea44a restart policy unless-stopped 2021-03-30 23:21:47 +03:00
Aarni Halinen 242a45a92e deploy: change prod sub domain for live 2021-03-30 22:30:11 +03:00
Aarni Halinen ad472ca8ff reapply filter backends 2021-03-30 19:48:22 +03:00
Aarni Halinen 928a98904b reapply filter backends 2021-03-30 19:33:36 +03:00
Toni Lyttinen 2882c1a4c8 oops 2021-03-30 15:17:24 +00:00
Toni Lyttinen 1e0c050f99 fixed lint and raised pagination page size to 1000 ":D" 2021-03-30 15:06:55 +00:00
Toni Lyttinen 744874a54c comment out pagination 2021-03-30 10:50:20 +00:00
Aarni Halinen 4dfa033f0b fix pycodestyle config path 2021-03-29 20:50:16 +03:00
Aarni Halinen d56ab02c27 remove sahkopiikki related code 2021-03-29 20:18:03 +03:00
Aarni Halinen 01c5a0ed53 add poetry files 2021-03-29 01:13:44 +03:00
Aarni Halinen 06fcfcf3a1 remove coffee_scale 2021-03-29 00:55:52 +03:00
Aarni Halinen 6567cd87d5 update npm packages 2021-03-29 00:52:15 +03:00
Aarni Halinen 9efe0d7489 use node v14 2021-03-29 00:48:54 +03:00
Aarni Halinen d7b6ef3c72 Change sik.party addresses to sahkoinsinoorikilta.fi 2021-01-18 21:39:25 +02:00
Aarni Halinen 0a31492733 Fix queryset filtering on new soft deletes 2021-01-15 00:27:41 +02:00
Aarni Halinen c96ff2f112 Merge branch 'feature/delete-apis' into 'develop'
Feature: Add delete endpoints for common models

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!33
2021-01-14 20:37:51 +00:00
Aarni Halinen 2b0d1c6ca7 Fix str format 2021-01-14 22:34:30 +02:00
Aarni Halinen 90342011f5 Add deleted prefix for deleted instances 2021-01-14 22:26:51 +02:00
Aarni Halinen 27f9c79cf3 Test Feed delete 2021-01-14 22:12:34 +02:00
Aarni Halinen de1ba7c9f2 Add soft delete functionality for Event, SignupForm, Feed & JobAd 2021-01-14 22:05:08 +02:00
Aarni Halinen c2fb77816a Order SignupForms by start_time 2021-01-14 21:26:28 +02:00
Aarni Halinen 4be0b75a1c Update production Docker secret names 2020-12-12 14:01:07 +02:00
Aarni Halinen 09aa42cfb8 Merge branch 'feature/signup-improvements' into 'develop'
Feature/signup improvements

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!31
2020-11-30 19:13:27 +00:00
Aarni Halinen c5008e3656 Add debug logging 2020-11-30 20:54:31 +02:00
Aarni Halinen e5224fe1e2 Lint fix 2020-11-23 20:23:44 +02:00
Aarni Halinen b834567309 API for getting signups for list view 2020-11-08 00:16:29 +02:00
Aarni Halinen b1921d4926 Add API for sending emails for signupees 2020-11-07 21:32:49 +02:00
Aarni Halinen 00c6920c8a Add test for editing signup with uuid 2020-11-07 21:00:55 +02:00
Aarni Halinen 1fe323cbdd Add soft delete API for signups 2020-11-07 20:40:59 +02:00
Aarni Halinen 3a58ff0ef1 Merge branch 'feature/remove-officials' into 'develop'
Remove Officials

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!30
2020-11-07 18:39:58 +00:00
Aarni Halinen d06c24bde0 Remove Officials 2020-11-07 18:39:58 +00:00
Aarni Halinen 2359743b20 Update pycodestyle 2020-11-07 19:28:59 +02:00
Aarni Halinen 437936ad64 Add inof about kaehmy limits 2020-11-07 17:13:35 +02:00
Toni Lyttinen 27dd56b6fb Merge branch 'feature/job-ads' into 'develop'
Add Job-ad DB object and serializer

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!29
2020-11-07 13:41:37 +00:00
Aarni Halinen ff5a92897c Authenticated filter for Job ads 2020-11-03 22:44:27 +02:00
Aarni Halinen e9c38d56d8 Compilemessages 2020-11-03 19:53:47 +02:00
Aarni Halinen 57bc12b621 Fix Feed test 2020-11-03 18:38:37 +02:00
Aarni Halinen 1ff188eddd Add Job-ads DB object and serializers 2020-11-03 18:27:46 +02:00
Toni Lyttinen b443b39457 added "toimikunta-appro" date to kaehmy.html 2020-10-28 13:29:44 +00:00
Toni Lyttinen 22615da3b4 updated kaehmy dates and deadlines kaehmy.html 2020-10-20 17:25:41 +00:00
Toni Lyttinen d09cbf3b2c changed deadline for board application kaehmy_banner.png 2020-10-20 17:23:33 +00:00
Aarni Halinen 66fcfab4da Revert "Use Docker:18 for CI/CD"
This reverts commit a7d0f49190.
2020-10-15 00:54:36 +03:00
Aarni Halinen a7d0f49190 Use Docker:18 for CI/CD 2020-10-15 00:35:09 +03:00
Aarni Halinen 519571f84c Remove filebrowser deployment 2020-10-15 00:03:25 +03:00
Aarni Halinen 30847e8bc2 Serialize location and title locales 2020-10-08 18:38:27 +03:00
Aarni Halinen df69a64ffc Merge branch 'feature/signup-email' into 'develop'
Feature/signup email HTML

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!25
2020-10-08 15:03:33 +00:00
Aarni Halinen 157f1c487c Get kahmyopas from static file server 2020-10-06 20:10:10 +03:00
Aarni Halinen 1e5a691d73 Send HTML email 2020-10-06 19:10:53 +03:00
Aarni Halinen 43fe25ba64 Get SignupForm email content from frontend 2020-10-06 18:33:41 +03:00
Toni Lyttinen 851269b13f fixed image src 2020-10-05 12:13:50 +00:00
Toni Lyttinen 0e5e18b035 Update kaehmy/static/kaehmy/img/kaehmy_banner.png, kaehmy/static/kaehmy/css/base.css, kaehmy/static/kaehmy/css/footer.css, kaehmy/static/kaehmy/css/header.css, kaehmy/static/kaehmy/css/nav.css, kaehmy/static/kaehmy/css/readme.md files 2020-10-05 12:12:02 +00:00
Toni Lyttinen f543e83e80 Update kaehmy/static/css/base.css, kaehmy/static/css/footer.css, kaehmy/static/css/header.css, kaehmy/static/css/nav.css, kaehmy/static/css/readme.md, kaehmy/static/img/kaehmy_banner.png files 2020-10-05 11:57:13 +00:00
Toni Lyttinen 0b72c20e32 more date fixing 2020-10-05 11:47:32 +00:00
Toni Lyttinen 04e6eb3ec2 changed dates on kaehmy.html 2020-10-05 11:22:54 +00:00
Toni Lyttinen 4e1efff7f2 changed kaehmy banner dates 2020-10-05 11:18:48 +00:00
Aarni Halinen d45f7195f5 Upgrade Pillow 2020-10-04 18:22:07 +03:00
Aarni Halinen dc6347a6eb Signup email and other model fields 2020-10-04 18:21:54 +03:00
Aarni Halinen 1304cffa2a Revert "SIK100 Seminar email hack"
This reverts commit 9b9406ab4b.
2020-09-22 17:58:33 +03:00
Aarni Halinen 656b2d1d95 Add missing envs 2020-08-31 03:59:03 +03:00
Aarni Halinen 9b9406ab4b SIK100 Seminar email hack 2020-08-31 03:56:37 +03:00
Aarni Halinen 3630b360d7 Test proxy configs to get API return https-urls 2020-08-29 14:48:58 +03:00
Aarni Halinen c6a3445774 Merge branch 'improve/serialization' into 'develop'
Hide invisible signups from event serialization

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!21
2020-08-06 19:06:19 +00:00
Aarni Halinen 9b7e9a6d92 Bubblegum fix for event test 2020-08-06 22:04:16 +03:00
Aarni Halinen 3de975203e Minor improvements 2020-08-06 20:59:26 +03:00
Aarni Halinen 38669947cd Some serialization BS 2020-08-04 01:04:38 +03:00
Aarni Halinen e03b6e6606 Try ordering via @property field order_by 2020-08-03 12:03:07 +03:00
Aarni Halinen 8491842a04 Try ordering via @property field order_by 2020-08-03 11:57:24 +03:00
Aarni Halinen eb80250335 Try SerializerMethodField for ordering list_names 2020-08-03 11:20:13 +03:00
Aarni Halinen dec348b032 Try ordering signups on pk 2020-07-31 16:59:27 +03:00
Aarni Halinen 5071bd6172 Serialize SignupForm visible 2020-07-24 23:31:35 +03:00
Aarni Halinen f98971270a New email secrets for prod 2020-07-24 22:21:44 +03:00
Aarni Halinen e2d55ffce2 Name fields 2020-07-24 00:41:07 +03:00
Aarni Halinen 37cd2eda4c Update tests 2020-07-24 00:16:10 +03:00
Aarni Halinen aa0ae01227 Move SignupForm validation schema building to front end 2020-07-23 23:50:12 +03:00
Aarni Halinen 54ded7d3f9 Add quota for SignupForms 2020-07-22 20:57:26 +03:00
Aarni Halinen ef38d8be46 Support uploading of images from event creation 2020-07-22 19:11:39 +03:00
Aarni Halinen 673bbc09eb Signup edit URL 2020-07-17 15:50:04 +03:00
Aarni Halinen 9fa62e9a2f Some cleaning 2020-07-16 13:57:12 +03:00
Aarni Halinen 32e0704f53 Add boolean for text vs html email 2020-07-16 13:56:54 +03:00
Aarni Halinen 39ab86fe3e Get first signup email through 2020-07-16 13:27:18 +03:00
Aarni Halinen f9e7c4a904 Update sikdata-mount.ps 2020-07-16 07:58:19 +00:00
Aarni Halinen 0adca6bd2e Mailjet 2020-07-16 01:50:46 +03:00
Aarni Halinen 5c4e4c7f5a Allow usage of normal ENVs for Docker setups 2020-07-16 01:35:11 +03:00
Aarni Halinen 76e1c71cd1 Use default Django secret key from settings.py 2020-07-16 00:48:01 +03:00
Aarni Halinen 67b31060b2 Fix deploy image 2020-07-16 00:31:12 +03:00
Aarni Halinen 110d426efd New Dev deploy 2020-07-16 00:21:18 +03:00
Aarni Halinen 62bb317c16 Add SIKData mount ps-script 2020-07-15 17:16:37 +03:00
Aarni Halinen a379390ca1 Very fast translations 2020-06-22 23:15:34 +03:00
Aarni Halinen 75ece86fb0 Signup email POC 2020-06-22 23:12:06 +03:00
Aarni Halinen 26af46fa12 UUID, email fields and receiver for sending them, /edit API for modifying signup with ID and UUID 2020-06-22 23:09:20 +03:00
Aarni Halinen 027b9c370c Clean test imports 2020-06-22 23:07:22 +03:00
Aarni Halinen 59c9fec51c Update CI 2020-06-16 23:05:11 +03:00
Aarni Halinen 98ea2d8a47 Update CI 2020-06-16 23:01:19 +03:00
Aarni Halinen 0b9aed128a Add identifying string to Signups and list them on Forms 2020-06-16 22:31:32 +03:00
Aarni Halinen 4ebba7f74a Cleaning imports 2020-06-16 19:23:25 +03:00
Aarni Halinen 11c36f2111 Merge branch 'feature/signup-validation' into 'develop'
Feature/signup validation

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!18
2020-06-16 16:18:58 +00:00
Aarni Halinen ef78ef9dcd Some linter setup 2020-06-16 19:18:11 +03:00
Aarni Halinen 34984d4a5e Clean test imports 2020-06-16 18:42:55 +03:00
Aarni Halinen 319324503f Split signup tests to 2 files 2020-06-16 17:57:48 +03:00
Aarni Halinen 683f50b199 CI updates 2020-06-16 17:39:03 +03:00
Aarni Halinen 2d6c474baa CI updates 2020-06-16 17:37:19 +03:00
Aarni Halinen b302681bbf Style fixes 2020-06-16 17:32:25 +03:00
Aarni Halinen 90d8ee2ea9 HTTP responses 2020-06-15 22:01:05 +03:00
Aarni Halinen f505fae3e6 Test signup POST 2020-06-15 20:25:24 +03:00
Aarni Halinen 2433c7828d Fix pattern generation 2020-06-15 20:02:01 +03:00
Aarni Halinen 0edde936cc Get jsonschema from questions JSON 2020-06-15 19:18:57 +03:00
Aarni Halinen 2e11621e5b Set Allow any for testing purposes 2020-06-15 19:18:24 +03:00
Aarni Halinen 5f706d9236 Install jsonschema 2020-06-15 19:17:33 +03:00
Aarni Halinen d3350c06e0 Minor CI changes 2020-03-09 18:08:43 +02:00
Aarni Halinen 648feaa762 Ignore admin.py and translation.py files on test coverage 2020-03-05 21:12:24 +02:00
Aarni Halinen 6d4662a1cb Add Django volumes to hidden directory on static file server 2020-03-05 21:00:20 +02:00
Aarni Halinen 523adcd256 Remove Pipenv possibility, bump deps 2020-02-22 19:45:28 +02:00
Aarni Halinen 5f0ab2ddbf Default PG password for dev and local development 2020-02-22 15:06:49 +02:00
Leo Lahti 6e3b3bd52f Bumped psycopg2 to 2.8.4 2020-02-22 14:38:38 +02:00
Toni Lyttinen 6dcbc1c652 Updated ohlhafv navbar color 2020-02-02 14:31:43 +00:00
Toni Lyttinen 80e00e2b05 Changed ohlhalv button hover color 2020-02-02 14:29:35 +00:00
Toni Lyttinen 80298d174f Updated challenge buttoncolor to match the page background 2020-02-02 14:15:00 +00:00
Aarni Halinen b790906b23 Fix year issue in contact tests 2020-02-02 15:31:16 +02:00
Toni Lyttinen e7164bb613 Update heevit.svg image to 2020 version 2020-02-02 13:29:15 +00:00
Toni Lyttinen a2a2b9830e Update background color to match the image 2020-02-02 13:28:41 +00:00
Aarni Halinen eb0bfdbd21 Move bad test fail one year forward 2020-02-02 15:26:29 +02:00
Toni Lyttinen d9116e51ca Updated background color to match image 2020-02-02 13:07:11 +00:00
Toni Lyttinen 3188a8e520 Replace heevit.svg 2020-02-02 13:01:42 +00:00
Toni Lyttinen a9c1d06ece Updated heevit.svg to 2020 version. 2020-02-02 12:59:23 +00:00
Aarni Halinen c32292c7d9 Allow api.sika.sik.party 2019-12-18 20:29:36 +02:00
Aarni Halinen f2ffcaa5a9 Parallelize CI a bit 2019-12-18 16:53:35 +02:00
Aarni Halinen d0216bb85c Update admin login url 2019-12-17 21:34:40 +02:00
Aarni Halinen 62263848f1 Add filebrowser and modify volume paths 2019-12-17 19:06:43 +02:00
Aarni Halinen 242199399b Use stop-first for PG update_config 2019-12-17 18:28:37 +02:00
Aarni Halinen 66d9ee0a75 Update backend postgres 2019-12-17 18:11:46 +02:00
Aarni Halinen c2222d4426 Fix lint 2019-11-22 18:09:53 +02:00
Aarni Halinen 368b28d241 Debug mode ALLOWED_HOSTS wildcard 2019-11-11 22:59:11 +02:00
Aarni Halinen c5df450a96 Minor import bug fix 2019-11-11 00:56:39 +02:00
Aarni Halinen c1e0a32a08 Merge branch 'feature/webapp-tests' into 'develop'
Feature/webapp tests

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!9
2019-11-10 22:55:40 +00:00
Aarni Halinen 373db50995 Minor fix to GET as admin 2019-11-11 00:47:22 +02:00
Aarni Halinen f422e31a42 Add some code to GET all objects as admin 2019-11-11 00:44:35 +02:00
Aarni Halinen f7cf54cab2 Fix webapp tests 2019-11-11 00:18:48 +02:00
Aarni Halinen d17e6710e6 Merge branch 'develop' into feature/webapp-tests 2019-11-10 21:38:07 +02:00
Aarni Halinen f64cec7d2e Fix Infernal Server Error on SignupForms 2019-11-10 21:34:10 +02:00
Aarni Halinen ff87767aab Merge branch 'develop' into feature/webapp-tests 2019-11-10 20:46:30 +02:00
Aarni Halinen 08ec9bb9cc Use json.loads for create and update of JSONField data 2019-11-10 20:46:16 +02:00
Aarni Halinen eb63c9fc1c Fix signup JSON form ID 2019-11-10 20:30:42 +02:00
Aarni Halinen eec157d7f3 Merge branch 'develop' into feature/webapp-tests 2019-11-10 20:28:06 +02:00
Jan Tuomi 1ce3c28e94 Use JSONField for signup and signupform models 2019-11-10 20:26:28 +02:00
Aarni Halinen 52a646fe04 Revert "Use JSONFields"
This reverts commit 5fba7d6249.
2019-11-10 20:25:21 +02:00
Aarni Halinen 8c4f6e886c New signup fixture 2019-11-10 20:13:27 +02:00
Aarni Halinen a9d6bf50d6 TemplateQuestion Tests 2019-11-10 20:00:13 +02:00
Aarni Halinen 8f0c9feecf Remove json dumps 2019-11-10 20:00:03 +02:00
Aarni Halinen 5fba7d6249 Use JSONFields 2019-11-10 19:24:18 +02:00
Aarni Halinen 3d755bca8c Remove translations from SignupFormSerializer 2019-11-10 19:19:08 +02:00
Aarni Halinen ff04e645e4 Merge branch 'develop' into feature/webapp-tests 2019-11-10 18:11:49 +02:00
Aarni Halinen 2c72e01353 Clean webapp views imports 2019-11-10 18:11:32 +02:00
Aarni Halinen 3836e00174 Merge branch 'develop' into feature/webapp-tests 2019-11-10 18:01:53 +02:00
Aarni Halinen b33f29d620 Merge branch 'feature_nginx_jwt_auth' into 'develop'
Add api with which nginx can authenticate users

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!8
2019-11-10 15:58:45 +00:00
Aarni Halinen 8afeec21cc Settings add localhost to allowed 2019-11-10 03:04:56 +02:00
Aarni Halinen 1778a0509c Minor fixes 2019-11-10 03:04:05 +02:00
Aarni Halinen 86ae2197f3 Contact API tests 2019-11-10 03:03:48 +02:00
Aarni Halinen 4859daf0b3 Clean old codebase from views.py 2019-11-10 02:00:45 +02:00
Aarni Halinen ff9cad1f47 Minor clean up 2019-11-10 01:58:32 +02:00
Aarni Halinen 01161db33b Test since query parameter 2019-11-10 01:58:15 +02:00
Aarni Halinen a7728e50dd Skeleton clean and small comment 2019-11-10 01:39:01 +02:00
Aarni Halinen edb6d73c06 Add signup create test skeleton 2019-11-10 01:36:08 +02:00
Aarni Halinen 0f50daf289 Singup get tests 2019-11-10 01:20:31 +02:00
Aarni Halinen f4b55b7863 Use month_from_now utility function in tests 2019-11-10 01:20:14 +02:00
Aarni Halinen 00de36ca44 Event CRUD tests 2019-11-09 23:58:21 +02:00
Jan Tuomi 59f47dec26 Update signup serializer for use with form ids 2019-11-09 23:51:13 +02:00
Aarni Halinen 8c4b997f0f Event test fixture 2019-11-09 23:13:56 +02:00
Aarni Halinen b2e2ff6699 Tag test fixture 2019-11-09 22:51:14 +02:00
Aarni Halinen ff98f700f9 Event POST unauthorized test 2019-11-09 22:19:06 +02:00
Aarni Halinen fe48a2a336 Event POST test 2019-11-09 22:18:19 +02:00
Aarni Halinen 80c8d9bc90 Fix inconsistency 2019-11-09 21:57:55 +02:00
Aarni Halinen 31ebace4cd Use context and other test fixes 2019-11-09 21:48:08 +02:00
Aarni Halinen b3a3a9815f Merge branch 'develop' into feature/webapp-tests 2019-11-09 21:15:29 +02:00
Aarni Halinen 81a16680e4 Ignore all .coverage files 2019-11-09 21:15:24 +02:00
Aarni Halinen 04e91a0e8d Check npm packages are OK 2019-11-09 21:14:02 +02:00
Aarni Halinen 72b2a18c63 Webapp test changes, GET for Event API 2019-11-09 21:09:25 +02:00
Antti Mäki 029089b32d Added language selection to the membership application form 2019-11-09 20:27:55 +02:00
Oksanen, Ilkka (Nokia - FI/Espoo) 3ea513785a Add api with which nginx can authenticate users 2019-11-09 16:55:12 +02:00
Aarni Halinen 8dc576983c Split tests.py into multiple files 2019-11-09 13:54:43 +02:00
Aarni Halinen a7ada33ff9 Open port 5432 on docker-compose 2019-11-09 13:41:46 +02:00
Aarni Halinen 59a59685d1 Merge branch 'feature/fix-official-models' into 'develop'
Fix Official models and API serializing

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!4
2019-11-03 15:58:18 +00:00
Aarni Halinen 2f0024630d Use IMAGE_NAME instead of removed dev image 2019-11-03 17:33:35 +02:00
Aarni Halinen e9706d0e4f Copy env file to dev deployment 2019-11-03 17:20:12 +02:00
Aarni Halinen baa329ad5d Run publish on dev branch 2019-11-03 17:13:08 +02:00
Aarni Halinen 389408a59e Merge branch 'feature/use-envs-for-settings' into 'develop'
Feature/use envs for settings

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!6
2019-11-03 15:09:41 +00:00
Aarni Halinen 2f4009d002 Update dev env 2019-11-03 17:06:24 +02:00
Aarni Halinen dab6f98ec2 Combine PROD and DEV images 2019-11-03 17:01:38 +02:00
Aarni Halinen b23e439eb5 Remove IS_DOCKER ENV 2019-11-03 16:55:36 +02:00
Aarni Halinen fdea5858ba Remove obsolete copy from setup.sh 2019-11-03 16:13:17 +02:00
Aarni Halinen 96fc8a5569 Update development docker setup 2019-11-03 16:06:14 +02:00
Aarni Halinen c408a6532e Add committee API 2019-10-10 20:48:39 +03:00
Aarni Halinen 09e973fab1 Allow missing official image 2019-10-10 20:48:27 +03:00
Aarni Halinen 971247e67c Show board status 2019-10-10 19:10:35 +03:00
Aarni Halinen 59dcb382ce Add images to Officials 2019-10-10 19:06:48 +03:00
Aarni Halinen 86af724ccc Add translations to API 2019-10-10 19:03:26 +03:00
Aarni Halinen e5cc62bbbf Use OccupationSerializer for the Contacts API 2019-10-10 18:38:45 +03:00
Aarni Halinen 4b63de6fc4 Merge branch 'develop' into feature/fix-official-models 2019-10-10 18:15:07 +03:00
Aarni Halinen d0d63a6e29 Add translations 2019-10-10 18:13:01 +03:00
Aarni Halinen d7f57c5b3a Clean webapp urls 2019-10-10 18:02:06 +03:00
Aarni Halinen 777cca4917 Merge branch 'develop' into feature/fix-official-models 2019-10-10 17:43:24 +03:00
Aarni Halinen e05fcb423c Fix bind mount paths 2019-10-10 01:05:06 +03:00
Aarni Halinen 7457b8a24d Add env var for unit tests 2019-10-10 00:56:44 +03:00
Aarni Halinen 8a3fdc40eb Merge branch 'develop' into feature/use-envs-for-settings 2019-10-10 00:43:48 +03:00
Aarni Halinen 192be6e28b Remove copy cmds from CI 2019-10-10 00:33:39 +03:00
Aarni Halinen 6ba91f1fab Add media bind mount for backend 2019-10-10 00:31:07 +03:00
Aarni Halinen 4725432c32 Merge branch 'feature/python-and-swarm-mods' into 'develop'
Update to python 3.7 and add deploy policies

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!5
2019-10-09 20:58:25 +00:00
Aarni Halinen 4e5b6c565a Update to python 3.7 and add deploy policies 2019-10-09 23:53:35 +03:00
Aarni Halinen 4e216891e6 Remove copy from Dockerfile.prod 2019-10-09 23:51:36 +03:00
Aarni Halinen 562738f945 Use env variables for settings.py variables 2019-10-09 23:49:57 +03:00
Aarni Halinen 7ffddf41f8 Fix some paths 2019-10-09 23:23:16 +03:00
Aarni Halinen 88f37928ac Downgrade postgres from 12 to 10 2019-10-09 22:21:46 +03:00
Antti Mäki fcd7ae7c04 Replace kahmyopas.pdf 2019-10-09 19:01:54 +00:00
Aarni Halinen 995d42640f Revert "Remove DB volume temporarly"
This reverts commit 046ae89d29.
2019-10-09 21:17:43 +03:00
Aarni Halinen 13583bd6ab Add depends on DB for backend 2019-10-09 19:33:22 +03:00
Aarni Halinen 522c804369 Remove DB name, use same as DB USER 2019-10-09 19:32:46 +03:00
Aarni Halinen 046ae89d29 Remove DB volume temporarly 2019-10-09 19:03:40 +03:00
Aarni Halinen 9ffec51537 Add ENV population to entrypoint.sh 2019-10-08 23:16:09 +03:00
Aarni Halinen c07ec5855a Revert "Read secrets from files to vars"
This reverts commit 84f1f9239b.
2019-10-08 23:07:45 +03:00
Aarni Halinen c445a4a66c Revert "Read ENV files runtime"
This reverts commit 96dd77e455.
2019-10-08 23:07:03 +03:00
Aarni Halinen 96dd77e455 Read ENV files runtime 2019-10-08 22:17:18 +03:00
Aarni Halinen 84f1f9239b Read secrets from files to vars 2019-10-08 20:54:54 +03:00
Aarni Halinen a24a7f02b9 Add _FILE ending for ENVs 2019-10-08 19:56:52 +03:00
Aarni Halinen d3c50dc608 Try other yml syntax 2019-10-08 19:42:49 +03:00
Aarni Halinen 34a4f027f5 Bump yml version 2019-10-08 13:04:30 +03:00
Aarni Halinen 66ed4c0713 Dockerize postgres 2019-10-08 12:41:40 +03:00
Aarni Halinen 1038e9c67e Fix syntax errors 2019-10-08 10:19:14 +03:00
Aarni Halinen 6a3398e8de Bump yml version 2019-10-08 10:01:19 +03:00
Aarni Halinen 8a87288d25 Add host network config 2019-10-08 09:40:53 +03:00
Aarni Halinen 1d4a509c7e Install whitenoise for serving static files 2019-10-08 09:34:56 +03:00
Aarni Halinen 29d2f6b90d Use Docker interface IP to access DB 2019-10-08 01:00:29 +03:00
Aarni Halinen 5d6cf1fb80 Add execution rights to entry scripåt 2019-10-08 00:46:37 +03:00
Aarni Halinen 95e72b7ab2 Add placeholder publish to fix dev server 2019-10-08 00:44:35 +03:00
Aarni Halinen d17d1fb1b7 Add entrypoint script 2019-10-08 00:29:20 +03:00
Aarni Halinen d0d822b8f4 Add network_mode host for DB access 2019-10-08 00:22:03 +03:00
Aarni Halinen f6abe6f999 Fix Prod container settings path 2019-10-08 00:04:59 +03:00
Aarni Halinen 8a5bbaa229 Remove docker-compose db volumes 2019-10-07 23:56:55 +03:00
Aarni Halinen 5750d62fe0 Fix production container 2019-10-07 23:53:07 +03:00
Aarni Halinen 71e683fbe3 Fix secret namespace 2019-10-07 22:03:05 +03:00
Aarni Halinen e214144ec3 Add external secrets 2019-10-07 21:28:16 +03:00
Aarni Halinen 0faf19e319 yml syntax fix 2019-10-07 21:19:05 +03:00
Aarni Halinen 10552c5f2a Try docker secrets 2019-10-07 21:10:19 +03:00
Aarni Halinen 4181b246a1 Add path to .ENV file on prod server 2019-10-07 20:17:02 +03:00
Aarni Halinen c39979e253 Use different python image 2019-10-07 20:16:35 +03:00
Aarni Halinen 807c599b85 Typo fix 2019-10-07 20:03:07 +03:00
Aarni Halinen 9e186c32ba Manual production deploy 2019-10-07 19:59:23 +03:00
Aarni Halinen e3d0709b31 Add new Dockerfile for prod 2019-10-07 19:56:55 +03:00
Aarni Halinen bd8fc6b404 New Sika Docker swarm deploy 2019-10-07 18:50:00 +03:00
Antti Mäki 8500ed8fbd Update header.css 2019-10-06 22:18:21 +00:00
Aarni Halinen cb86c9a2ae Fix Kaehmy PresetRole rendering by removing wrap_label from checkbox_option.html 2019-10-06 18:32:17 +03:00
Aarni Halinen bb0f4244c7 Update django-bootstrap3 2019-10-06 18:31:18 +03:00
Aarni Halinen cd2fe4e8f2 Update kaehmy dates 2019-10-06 15:34:35 +03:00
Antti Mäki bf3f1f783c Replace kaehmy_banner.png 2019-10-06 11:03:09 +00:00
Antti Mäki 37f509ff76 Replace kaehmy_banner.png 2019-10-06 11:02:01 +00:00
Aarni Halinen b58dbde83c Minor cleanup 2019-09-28 19:52:14 +03:00
Aarni Halinen 0da0a02bac Get Officials by year with query param year 2019-09-28 17:41:37 +03:00
Aarni Halinen fef74dd995 Fix brainfart 2019-09-26 21:03:26 +03:00
Aarni Halinen 2356365197 Reconstruct migrations (squash merge request) 2019-09-26 20:52:11 +03:00
Aarni Halinen 5a29c8c49d Set contact serializer 2019-09-26 20:43:13 +03:00
Aarni Halinen e365c394d8 Fix user creation receiver at official creation 2019-09-26 20:16:37 +03:00
Aarni Halinen 22371b8f15 Locales 2019-09-26 19:22:11 +03:00
Aarni Halinen 32feb46f88 Add occupation model to function as history of roles 2019-09-26 19:17:10 +03:00
Aarni Halinen 6c77fe4da6 Update autocomplete-light in requirements 2019-09-16 19:59:34 +03:00
Aarni Halinen 5dc7442d03 Update Python version and Django-autocomplete-light 2019-09-16 19:57:47 +03:00
Aarni Halinen 9f664737b6 Add Member application emails 2019-09-16 19:44:14 +03:00
Aarni Halinen 1c3b4367a2 Fix POST permissions for submit application 2019-09-16 17:55:14 +03:00
Leo Kivikunnas 9a9757c914 Moved expenses claim development to its own feature branch 2019-06-03 19:52:12 +03:00
Leo Kivikunnas 2bf19d357e Fixed IBAN validation and amount field in exenses claim and added some tests 2019-06-03 19:35:08 +03:00
Aarni Halinen 7e31f72301 Update docker image to new registry 2019-05-27 23:40:27 +03:00
Aarni Halinen 68bb003411 Fix .md file style warnings 2019-05-27 23:38:54 +03:00
Antti Mäki 7133f36e5d cd: web2.0: No such file or directory 2019-05-27 18:01:39 +00:00
Leo Kivikunnas c9962c4d8e Fixed style errors 2019-05-27 20:46:56 +03:00
Leo Kivikunnas 5832bd1765 Added venv got .eslintignore 2019-05-27 20:35:45 +03:00
Leo Kivikunnas 4046d2c753 Started work on expenses claim 2019-05-27 20:32:18 +03:00
Aarni Halinen 93298618ae Add docker login to deploy dev 2019-05-27 17:48:48 +03:00
Aarni Halinen 709a637ae2 Update repo url 2019-05-23 19:07:33 +03:00
Aarni Halinen a88bb30b62 Revert "Use same registry as frontend"
This reverts commit 38527207ac.
2019-05-23 19:03:57 +03:00
Aarni Halinen 38527207ac Use same registry as frontend 2019-05-23 15:40:39 +00:00
Aarni Halinen 6f90fcc016 Fix docker login on publish 2019-05-23 05:09:09 +00:00
Aarni Halinen 1e633ded31 Use gitlab-deploy-token
https://docs.gitlab.com/ee/user/project/deploy_tokens/
2019-05-22 03:51:15 +00:00
Aarni Halinen 4b3b8be4e4 Update publish in gitlab-ci.yml 2019-05-22 03:03:26 +00:00
Aarni Halinen effd58a424 Remove ilmotunkki 2019-04-02 15:16:23 +03:00
Aarni Halinen 850587006c Merge branch 'feature-infoscreen-lunch' into 'develop'
Feature infoscreen lunch

See merge request vtmk/web2.0!136
2019-03-26 17:39:19 +02:00
Aarni Halinen 423b574cca Add Today's lunch infoscreen 2019-03-26 17:33:09 +02:00
Aarni Halinen 7bb4a6cfc1 Fix webapp tests 2019-03-26 17:10:25 +02:00
Aarni Halinen 94f392ab87 Set pipenv and pyenv support 2019-03-26 15:44:50 +02:00
Aarni Halinen ccef40e63f Fix pycodestyle on webapp 2019-03-26 14:41:11 +02:00
Aarni Halinen 1c51b666ab Clean old infoscreen code and statics 2019-03-26 14:39:51 +02:00
Jan Tuomi b5462d5757 Turn questions field into a text field 2019-03-13 16:45:18 +02:00
Jan Tuomi 587632d7a3 Rename signup form fields and add title 2019-03-13 15:54:23 +02:00
Jan Tuomi 11c92cdd5f Fix feed serializer and view 2019-03-13 13:53:06 +02:00
Jan Tuomi e4577e13e0 Add autohide_enabled field to Feed 2019-03-13 13:52:44 +02:00
Jan Tuomi 6365e0c63e Allow POST requests to event API 2019-03-12 15:17:07 +02:00
Aarni Halinen 4735541344 Add missing migration 2019-03-12 15:16:08 +02:00
Aarni Halinen 8e40434867 Update favicon 2019-03-12 15:14:09 +02:00
Aarni Halinen 8194ab43cd Add location to Event object 2019-03-12 15:10:52 +02:00
Jan Tuomi a708a6377d Fix JWT auth settings in base.py 2019-03-11 20:51:29 +02:00
Aarni Halinen 3fc810697a Merge branch 'feature-heevibotti' into 'develop'
Add barebones to better tgbot

See merge request vtmk/web2.0!134
2019-02-08 19:25:10 +02:00
Aarni Halinen 3305704926 Fix pycodestyle 2019-02-08 19:10:36 +02:00
okalintu 206ec80a9a Remove f-word 2019-02-08 19:05:22 +02:00
okalintu dce19b8d38 Ensure that unnecessary tg messages will not crash anything useful 2019-02-08 18:31:45 +02:00
okalintu 8a8751ce66 Add barebones to better tgbot
Also send tg spam from ohlhafv challenges!
2019-02-08 18:26:06 +02:00
Aarni Halinen 0f0389b8ff Merge branch 'develop' into 'master'
Ohlhafv hotfix: email

See merge request vtmk/web2.0!133
2019-02-04 18:38:34 +02:00
Aarni Halinen 061c9c8483 Fix Ohlhafv email date 2019-02-04 18:24:49 +02:00
Aarni Halinen 005d34daf5 Add EOF blank line base.py 2019-01-29 13:35:59 +02:00
Aarni Halinen 95e028d546 Revert "Remove underscore.js"
This reverts commit 50268b98a9.
2019-01-29 12:53:26 +02:00
Jan Tuomi 95c29d8528 Increase JWT expiration time to 1 week 2019-01-28 21:39:45 +02:00
Jan Tuomi bda342b05b Add gunicorn to production requirements 2019-01-28 21:39:30 +02:00
Aarni Halinen 889ad4f980 Merge branch 'develop' into 'master'
Ohlhafv and dependency fixes

Closes #117

See merge request vtmk/web2.0!132
2019-01-28 16:01:56 +02:00
Jan Tuomi a5bca8eab1 Add JWT verify endpoint 2019-01-17 15:48:49 +02:00
Aarni Halinen 2dfb53bd5e Use node:alpine 2019-01-15 20:04:21 +02:00
jaine 474df33a99 Fix borders in ohlhafv form 2019-01-15 16:42:08 +02:00
Aarni Halinen a2906966ba Use node latest on CI 2019-01-15 16:06:04 +02:00
Aarni Halinen a81096fa13 Update pyexcel to most recent version
Updating openpyxl or pyexcel-xlsx results error in tablib dependency
2019-01-15 16:02:55 +02:00
Aarni Halinen b56ff6c5cd Rollback pyexcel dependencies 2019-01-15 15:49:25 +02:00
Jan Tuomi 168de8088b Update Django to 2.1.5 and setup JWT auth 2019-01-15 15:41:40 +02:00
Aarni Halinen e7862df57c Use Python 3.5 image consistently 2019-01-15 15:25:40 +02:00
Jan Tuomi ec829a5683 Update .gitignore and requirements.txt 2019-01-15 14:00:20 +02:00
jaine bb3476a8ad Updated ohlhafv page css and img 2019-01-14 19:55:04 +02:00
jaine bab5c88061 Add help in error case in mac installation instruction 2019-01-14 19:15:02 +02:00
Aarni Halinen 7431aadfba Merge branch 'feature-API-filtering' into 'develop'
Feature api filtering

See merge request vtmk/web2.0!131
2018-11-18 19:05:14 +02:00
Aarni Halinen 1ecf3c368b Add authentication for post test 2018-11-18 18:58:12 +02:00
Aarni Halinen d3e6013840 Fix API test by getting results from json 2018-11-18 18:12:41 +02:00
Aarni Halinen e1220d17bb Add filtering to REST API 2018-11-18 17:56:32 +02:00
Aarni Halinen 55fdf8f60d Add filtering for Event and Signup ViewSets 2018-11-18 17:54:11 +02:00
Aarni Halinen 65aac3daf1 Add LimitOffsetPagination 2018-11-18 17:54:11 +02:00
Joel Lavikainen 1f8e9e582a Make tag tests more generic 2018-11-18 17:52:34 +02:00
Aarni Halinen 97e6ce3d8d Fix webapp migrations 2018-11-18 13:46:31 +02:00
Aarni Halinen 316ab679f8 Remove webapp migration 0048 2018-11-18 13:33:30 +02:00
Aarni Halinen bf5620c3b6 Revert "Remove PK slug from ancient migration"
This reverts commit 90f430c95c.
2018-11-18 13:31:48 +02:00
Joel Lavikainen 642aa9847f Revert model change 2018-11-18 04:58:59 +02:00
Aarni Halinen 90f430c95c Remove PK slug from ancient migration 2018-11-18 04:50:34 +02:00
Joel Lavikainen bf4c5bf3d9 Fix feed testcase 2018-11-18 04:43:49 +02:00
Joel Lavikainen b7beb72409 Fix linting errors 2018-11-18 04:39:31 +02:00
Joel Lavikainen 0617dd6a93 Add generation of field data 2018-11-18 04:29:04 +02:00
Joel Lavikainen d99f9c53f7 Add migration with fix 2018-11-18 04:21:01 +02:00
Joel Lavikainen 3cfa0df43b Add missing lines to coverage report 2018-11-17 22:40:43 +02:00
Joel Lavikainen dc2982965e Add migration related to tag change 2018-11-17 22:30:03 +02:00
Joel Lavikainen 3c58d764bd Fix Feed link to Tag 2018-11-17 21:46:17 +02:00
Joel Lavikainen 4d2584dee4 Change Tag primary key to id 2018-11-17 21:45:26 +02:00
Joel Lavikainen 3294d6ffa0 Fix Tag serializer 2018-11-17 20:41:45 +02:00
Joel Lavikainen 8398928a97 Add dummy data generation for tag objects 2018-11-17 20:40:42 +02:00
Joel Lavikainen 09a2e09c1b Add tests for Tag REST api 2018-11-17 20:40:08 +02:00
Joel Lavikainen d0f5bc223b Add id to Tag data 2018-11-17 17:57:06 +02:00
Joel Lavikainen 7a58fb0af5 Add tag id support for Feed in REST 2018-11-17 17:52:35 +02:00
Joel Lavikainen 395c597a7f Add tags to REST API 2018-11-17 17:34:36 +02:00
Aarni Halinen e43734e32e Fix naive dates to aware datetimes 2018-10-25 14:36:51 +03:00
Aarni Halinen eb5659d0da Minor cleanup of infoscreen 2018-10-24 20:54:31 +03:00
Aarni Halinen 50268b98a9 Remove underscore.js 2018-10-24 20:54:08 +03:00
Aarni Halinen 4a2a5f9d76 Bugfix #117: API Event tags
Add API for tags so events can get the related field.
2018-10-23 14:45:08 +03:00
Aarni Halinen ef6b8ed5a5 Merge branch 'develop' into 'master'
Kaehmy translations

See merge request vtmk/web2.0!129
2018-10-20 23:24:04 +03:00
Aarni Halinen b1eda70e7a Kaehmy translations 2018-10-20 23:14:48 +03:00
Aarni Halinen 2ae9ee7352 Merge branch 'develop' into 'master'
GDPR kaehmy

See merge request vtmk/web2.0!128
2018-10-20 23:00:59 +03:00
Aarni Halinen f7b00ab3cc Add GDPR checkbox 2018-10-20 22:51:42 +03:00
Aarni Halinen 9cad12d879 Login required for kaehmy export page 2018-10-20 22:39:22 +03:00
Aarni Halinen 5967d0f7b3 Merge branch 'develop' into 'master'
Replace kahmyopas.pdf

See merge request vtmk/web2.0!127
2018-10-19 13:50:51 +03:00
Aarni Halinen d4800c449d Replace kahmyopas.pdf 2018-10-19 13:41:27 +03:00
Aarni Halinen 8f9c504bec Merge branch 'develop' into 'master'
Update kaehmy banner

See merge request vtmk/web2.0!126
2018-10-18 23:31:30 +03:00
Aarni Halinen d3d4ce5e5d Real update to kaehmy banner 2018-10-18 23:22:04 +03:00
Aarni Halinen 9dbc2424b1 Update kaehmy banner 2018-10-18 23:02:16 +03:00
Aarni Halinen 32771493f3 Merge branch 'develop' into 'master'
Remove culture category

See merge request vtmk/web2.0!125
2018-10-18 22:43:14 +03:00
Aarni Halinen 5b38065f13 Remove culture category 2018-10-18 21:21:29 +03:00
Aarni Halinen 1879c265cd Update kaehmy dates 2018-10-18 21:20:37 +03:00
Aarni Halinen c654c41380 Merge branch 'develop' into 'master'
Update final kaehmy date

See merge request vtmk/web2.0!124
2018-10-16 19:04:12 +03:00
Aarni Halinen 4273b95b70 Update final kaehmy date 2018-10-16 18:53:29 +03:00
Aarni Halinen e4cffd5667 Merge branch 'develop' into 'master'
Update Kaehmy pages

See merge request vtmk/web2.0!123
2018-10-15 20:01:21 +03:00
Aarni Halinen e96698ef2e Update kaehmy translations 2018-10-15 18:33:14 +03:00
Aarni Halinen e04b8ddb9b Update kaehmy dates 2018-10-15 18:30:08 +03:00
Aarni Halinen 6fe3e69cd9 Update package-lock 2018-10-03 14:38:50 +03:00
Aarni Halinen 7d1a8bd284 Ignore sik_test 2018-10-03 14:38:30 +03:00
Aarni Halinen 5b44d2e4c7 Fix favicon 2018-09-10 21:08:37 +03:00
Aarni Halinen fa0954e8ca Merge branch 'develop' into 'master'
Sosso infocreen fix, Django 2.0, Rest Framework

See merge request vtmk/web2.0!121
2018-09-10 13:35:12 +03:00
Aarni Halinen 8552bde245 Fix members static file paths 2018-09-10 13:16:51 +03:00
Aarni Halinen 9a4d7fc498 Fix Sosso containers 2018-09-10 12:04:50 +03:00
Aarni Halinen 6dea241408 Add missing import 2018-09-10 11:43:59 +03:00
Aarni Halinen b3b1bec12c Add special characters to Sosso infoscreen 2018-09-10 11:40:57 +03:00
Aarni Halinen 02cc305abf Fix indentation 2018-09-02 22:27:14 +03:00
Aarni Halinen ffe0c45eea Fix few kaehmy problems
- Fix variable naming in statistics
- Add scope for html files to fix rendering of errors
- Fix footer.css path and remove duplicate
2018-09-02 22:23:52 +03:00
Aarni Halinen 499ddc0979 New kaehmy BaseRole class 2018-09-02 22:03:54 +03:00
Aarni Halinen b154ffb79e Add normal permissions to DRF root 2018-08-21 19:27:18 +03:00
Aarni Halinen 87dfab0e57 Change dev server port on gitlab-ci.yml 2018-08-15 23:37:40 +03:00
Aarni Halinen 92ec8b1b4e Dev server docker and host ports to 8000 2018-08-15 23:32:41 +03:00
Aarni Halinen ac8fb0bfe3 Set authentication to webapp DRF 2018-07-24 19:09:42 +03:00
Aarni Halinen 0ce6af8f7c Fix import and redefinition issues 2018-07-24 18:30:21 +03:00
Aarni Halinen 053b705cc1 Merge branch 'Django2.0' into 'develop'
:Django2.0

See merge request vtmk/web2.0!115
2018-07-24 18:29:00 +03:00
Aarni Halinen 3676f23f65 Fix payment autocomplete permissions and remove test skips
Fixed decorators in urls.py. Moved to method_decorators on view class
2018-07-24 18:19:57 +03:00
Aarni Halinen 7e821f277f Fix pycodestyle 2018-07-23 12:38:14 +03:00
Aarni Halinen 91cbdef71f Merge branch 'develop' into 'Django2.0'
# Conflicts:
#   webapp/urls.py
2018-07-18 20:44:23 +03:00
Aarni Halinen 0cfb78bc69 Remove not used api_view 2018-07-18 20:40:44 +03:00
Aarni Halinen 01c20b1a6e Add contacts API 2018-07-18 20:40:19 +03:00
Aarni Halinen 1711aca5ec Add templatequestions API 2018-07-18 20:39:08 +03:00
Aarni Halinen c536899cc9 Bring about page back 2018-07-18 20:12:06 +03:00
Aarni Halinen 60da9d8256 Add event update serializer 2018-07-18 20:11:24 +03:00
Aarni Halinen a923e225e8 API root to /api 2018-07-18 18:41:20 +03:00
Aarni Halinen 2d7c9d779a Feed API added 2018-07-18 18:37:01 +03:00
Aarni Halinen aea9898563 Skip failing autocomplete test 2018-07-17 22:00:39 +03:00
Aarni Halinen 4e3f71ea43 Remove duplicate imports 2018-07-17 22:00:08 +03:00
Aarni Halinen 6acbdbc760 Update to Django 2.0.7 for sqlite bugfix 2018-07-17 21:37:23 +03:00
Aarni Halinen 11b6e68fe1 Remove password_reset and own login, redirect to admin/login
Django admin login to be used. Thus we should be able to upgrade to
Django2.0
2018-07-17 20:58:13 +03:00
Aarni Halinen cc3aa66e49 Merge branch 'develop' into Django2.0 2018-07-17 20:57:58 +03:00
Aarni Halinen 563344e8b4 Merge branch 'feature-events' into 'develop'
Basic API for events

See merge request vtmk/web2.0!120
2018-07-17 18:43:01 +03:00
Aarni Halinen 129b8e4601 Use id instead of url for SignUpSerializer 2018-07-10 22:42:37 +03:00
Aarni Halinen efde69984d Revert changes to base.py 2018-07-10 22:42:05 +03:00
Aarni Halinen c66c8e7367 Rest framework for Event and SignupForm 2018-07-10 22:33:26 +03:00
Aarni Halinen c31f454c78 Move signup models back to webapp 2018-07-05 18:58:33 +03:00
Aarni Halinen 18926d16d1 Create new signup related models 2018-06-19 20:46:06 +03:00
Aarni Halinen 4e8adebb2d Move Event and Registration model to own app 2018-06-05 19:33:35 +03:00
Aarni Halinen 0207bdf22b Upgrade psycopg2 2018-05-31 17:26:49 +03:00
Aarni Halinen 5caacd8f44 Add and fix translations 2018-05-22 23:54:58 +03:00
Aarni Halinen d7a3433d2c Merge branch 'feature-contacts' into develop
Conflicts:
	webapp/admin.py
	webapp/models.py
	webapp/views.py
2018-05-16 22:49:38 +03:00
Aarni Halinen 6e68e106aa Update contact models and template 2018-05-16 22:39:43 +03:00
Aarni Halinen aeda06374d Merge branch 'develop' into 'master'
Filter paid member fees by date

See merge request vtmk/web2.0!118
2018-05-14 01:45:07 +03:00
Aarni Halinen 9225ff5967 Filter paid member fees by date 2018-05-14 01:36:11 +03:00
Aarni Halinen ac64a1766f Merge branch 'develop' into 'master'
Member features into master

Closes #103

See merge request vtmk/web2.0!117
2018-05-13 13:35:50 +03:00
Aarni Halinen 6996bb8015 Merge branch 'feature-number-of-members' into 'develop'
Show number of paid members in member list

See merge request vtmk/web2.0!116
2018-05-13 13:15:30 +03:00
Aarni Halinen 7aff7c46ee Fix pycodestyle 2018-05-13 13:06:19 +03:00
Aarni Halinen 882732d054 Show number of paid members in member list
Member filtering also applies to this feature. Moved 'last_paid' Subquery to Member method
2018-05-13 13:02:27 +03:00
Aarni Halinen 9e0d911f7b Fix date rendering 2018-05-09 22:16:40 +03:00
Aarni Halinen ab6b7d19fb Update pyexcel 2018-05-09 21:24:36 +03:00
Aarni Halinen b95be67051 Fix pycodestyle 2018-05-09 20:24:16 +03:00
Aarni Halinen 48b6ed5b69 Update Django 2.0 2018-05-09 20:05:20 +03:00
Aarni Halinen e25041d38d Update django-nose 2018-05-09 18:57:29 +03:00
Aarni Halinen 7bc77ef232 Update django-suit 2018-05-09 18:49:01 +03:00
Aarni Halinen 0f8a7d76da Update auditlog 2018-05-09 18:46:35 +03:00
Aarni Halinen ecf34d9039 Fix deprecations in project 2018-05-09 18:33:59 +03:00
Aarni Halinen a9cf253c83 Silence pyexcel DEBUG logs
Close issue #103
2018-05-07 01:12:54 +03:00
Aarni Halinen 884c2552a8 Merge branch 'develop' into 'master'
Merge sorting fix

Closes #105

See merge request vtmk/web2.0!114
2018-03-26 18:09:27 +03:00
Aarni Halinen 45e98e0220 Fix uncommited code 2018-03-02 02:57:26 +02:00
Aarni Halinen d8ea26c777 Pycodestyle fixes 2018-03-02 02:48:18 +02:00
Aarni Halinen c398e53750 Add translations 2018-03-02 02:45:59 +02:00
Aarni Halinen 9ce0eccfce Move member specific error to member app 2018-03-02 02:43:02 +02:00
Aarni Halinen 17e6bb86ed Fix last paid sorting
Bug #105. Rendering needs better formatting.
2018-03-02 02:40:42 +02:00
Aarni Halinen a1b85b3c6c Merge branch 'bugfix-members-sort' into 'develop'
Bugfix: #105

See merge request vtmk/web2.0!113
2018-03-02 00:40:28 +02:00
Aarni Halinen fafc988a60 Fix sorting bug #105
Also removed unneeded code
2018-03-02 00:32:11 +02:00
Elias 55bcc78670 Sorted roles by committees and some basic layout 2018-03-02 00:31:10 +02:00
Elias 7bc277a978 korjauksia 2018-03-01 20:53:31 +02:00
Elias 780e2d6acb Committee model 2018-03-01 19:28:27 +02:00
Aarni Halinen bbc5743c39 Add VSCode workspace files to gitignore 2018-03-01 19:27:51 +02:00
Aarni Halinen f9082237e6 Merge branch 'develop' into 'master'
Develop

See merge request vtmk/web2.0!112
2018-02-26 16:13:05 +02:00
Jan Tuomi 3298e55fb0 Fix password reset form error 2018-02-25 20:34:39 +02:00
Aarni Halinen 2b2d20f796 Remove references to deleted css files 2018-02-22 16:31:12 +02:00
Aarni Halinen a72b313b83 Merge branch 'develop' into 'master'
Revert deletion of footer-padder element

See merge request vtmk/web2.0!111
2018-02-22 01:51:53 +02:00
Aarni Halinen 117802bf10 Revert deletion on footer-padder element 2018-02-22 01:43:15 +02:00
Aarni Halinen 94f8a92e65 Merge branch 'develop' into 'master'
Merge footer fix

See merge request vtmk/web2.0!110
2018-02-22 00:48:16 +02:00
Aarni Halinen 8bd53ba897 Fix footer bug #104 2018-02-21 22:18:43 +02:00
Aarni Halinen 5114b2ef85 Revert "Remove bugging footer from infoscreen"
This reverts commit d7f53b9700.
2018-02-06 20:47:43 +02:00
Aarni Halinen f80cbd7457 Merge branch 'develop' into 'master'
Hide bugging infoscreen footer

See merge request vtmk/web2.0!109
2018-02-06 19:40:53 +02:00
Aarni Halinen d7f53b9700 Remove bugging footer from infoscreen 2018-02-06 19:32:28 +02:00
Aarni Halinen 1ab3180c0d Add 'Wall' flag to pre-push hook
This should help noticing deprecations
2018-02-05 10:25:01 +02:00
Aarni Halinen 009495b11b Merge branch 'develop' into 'master'
Add message to Ohlhafv email

See merge request vtmk/web2.0!108
2018-02-01 22:36:28 +02:00
Aarni Halinen b8a8cb2c6d Add message to Ohlhafv email 2018-02-01 22:23:02 +02:00
Aarni Halinen f9bb4bba25 Merge branch 'develop' into 'master'
ABB infoscreen fixes

See merge request vtmk/web2.0!107
2018-02-01 22:22:02 +02:00
Aarni Halinen a56e8ef241 Fix typo 2018-02-01 22:11:50 +02:00
Aarni Halinen d5d11edbe7 Fix remark issues in ilmotunkki readme 2018-02-01 16:32:14 +02:00
Aarni Halinen f7c2516cd7 Fix ABB.css header height issue 2018-02-01 16:26:57 +02:00
Aarni Halinen 45b27e3ac9 Fix ABB.html empty jobs path 2018-02-01 15:53:04 +02:00
Aarni Halinen fe71f24ced Merge branch 'develop' into 'master'
Fix ABB css in infoscreen

See merge request vtmk/web2.0!106
2018-01-30 17:36:35 +02:00
Aarni Halinen 52613ba7d4 Fix ABB css in infoscreen 2018-01-30 17:28:14 +02:00
Aarni Halinen af2719082e Merge branch 'develop' into 'master'
Develop

See merge request vtmk/web2.0!105
2018-01-30 17:10:52 +02:00
Aarni Halinen f136b34b6c Merge branch 'hotfix-ohlhafv-form' into 'develop'
Remove unneeded challenger email field

See merge request vtmk/web2.0!104
2018-01-30 17:00:56 +02:00
Aarni Halinen 4d90454cf8 Remove unneeded challenger email field 2018-01-30 16:48:41 +02:00
Aarni Halinen 82e0c5c995 Merge branch 'feature-ohlhafv-mail' into 'develop'
Feature ohlhafv mail

See merge request vtmk/web2.0!103
2018-01-30 16:44:03 +02:00
Aarni Halinen dec3bf5ccf Remove old code 2018-01-30 16:34:53 +02:00
Aarni Halinen 23c00ce167 Add Email sending to Ohlhafv 2018-01-30 16:23:19 +02:00
Aarni Halinen bdc21f79e8 Fix missing settings import 2018-01-30 14:50:32 +02:00
Aarni Halinen 2fc71eabe3 Merge branch 'feature-refactor-webapp' into 'develop'
Feature refactor webapp

See merge request vtmk/web2.0!102
2018-01-30 11:38:58 +02:00
Jan Tuomi 3debd4b1ec Fix comment data migration 2018-01-30 10:51:20 +02:00
Jan Tuomi b765ae37e8 Remove unused print 2018-01-28 23:45:40 +02:00
Jan Tuomi 9eae16110c Write data migration for ohlhafv challenges 2018-01-28 23:39:27 +02:00
Jan Tuomi ce1f4eb7c9 Write data migrations for kaehmys 2018-01-28 23:30:22 +02:00
Jan Tuomi 661dc84973 Fix pycodestyle 2018-01-28 21:19:19 +02:00
Jan Tuomi 6b21ea4af8 Move postgres init to own script 2018-01-28 21:14:00 +02:00
Jan Tuomi 37ab278086 Refactor member register 2018-01-28 20:59:15 +02:00
Jan Tuomi 509b157d65 Refactor coffee scale app 2018-01-28 20:32:07 +02:00
Jan Tuomi 253f720043 Restructure webapp and infoscreen 2018-01-28 20:23:56 +02:00
Jan Tuomi bdf6b469ad Move ohlhafv to its own app 2018-01-28 18:54:45 +02:00
Jan Tuomi 7dc9fac597 Fix kaehmy styles and templates 2018-01-28 16:56:51 +02:00
Jan Tuomi 77330dffe9 Refactor how url loading works for static files 2018-01-26 08:22:48 +02:00
Jan Tuomi f0ea3505e4 Move and rename a lot of stuff into kaehmy app 2018-01-26 01:15:35 +02:00
Jan Tuomi 06c2a2b9a6 Rename kaehmy templates 2018-01-25 23:28:49 +02:00
Jan Tuomi c671206e8a Rename pre-commit to pre-push 2018-01-25 22:36:38 +02:00
Jan Tuomi cf50050eba Update pre-commit script 2018-01-25 22:23:51 +02:00
Aarni Halinen f8e68acd4d Fix pydcodestyle warnings 2018-01-25 21:57:23 +02:00
Jan Tuomi 9b6fc5e687 Fix openpyxl version conflict by downgrading to 2.4.11 2018-01-25 21:52:34 +02:00
Aarni Halinen 7d17d8a84f Add Ohlhafv to admin and auditlog 2018-01-25 21:36:10 +02:00
Jan Tuomi b2aa6d1a3e Bump django-import-export version 2018-01-25 21:33:40 +02:00
Jan Tuomi 5a2c6d9aaa Bump pyexcel and pyexcel-xlsx versions 2018-01-25 21:25:15 +02:00
Aarni Halinen 1ecbda0731 Update ilmotunkki readme 2018-01-25 21:21:12 +02:00
Jan Tuomi 9e9049709b Fix display issue in charfield 2018-01-25 20:55:03 +02:00
Jan Tuomi ac9a5db356 Add missing translations 2018-01-25 20:54:37 +02:00
Aarni Halinen 67ed7edefb Merge branch 'feature-ohlhafv' into develop 2018-01-25 20:19:47 +02:00
Aarni Halinen 181be6b80c Fix bug in Ohlhafv model regarding translation 2018-01-25 20:10:54 +02:00
Aarni Halinen 1e2bf10494 Allow blank Ohlhafv messages 2018-01-25 20:06:17 +02:00
Jan Tuomi a219b930b3 Make a title black 2018-01-25 18:33:04 +02:00
Jan Tuomi 78ba2d7afa Add hot new designs to Ohlhafv 🔥 2018-01-25 18:31:06 +02:00
Jan Tuomi 6fe01dadf1 Add a couple missing translations 2018-01-25 16:30:05 +02:00
Aarni Halinen 9df62a1247 Fix translations 2018-01-24 19:09:51 +02:00
Aarni Halinen a9164f8c6e Construct Ohlhafv page based on kaehmy 2018-01-24 19:02:44 +02:00
Aarni Halinen 6e5074f8fe Rearrange html files to folders 2018-01-24 18:12:21 +02:00
Elias efe8808e79 Yhteystiedot alustava 2018-01-24 17:48:14 +02:00
Aarni Halinen 77cdce714a Add translations to Ohlhafv page 2018-01-24 17:37:15 +02:00
Aarni Halinen 69c1b2dcb2 Add team challenge option 2018-01-24 17:20:55 +02:00
Aarni Halinen 2a50f7ef43 Pycodestyle whitepsace fixes 2018-01-24 16:46:34 +02:00
Jan Tuomi 0c93446b81 Add some translations 2018-01-24 16:32:29 +02:00
Jan Tuomi 0e52efb449 Fix footer pos and add placeholder content 2018-01-24 16:24:54 +02:00
Elias 283d5b566e Except handling for 'Git not found' in about page 2018-01-24 16:14:29 +02:00
Jan Tuomi a4367bbc9d Merge branch feature-refactor-login 2018-01-10 19:54:08 +02:00
Jan Tuomi 935f7a38f1 Fix login styles 2018-01-10 19:49:59 +02:00
henu 9973057051 Add new styles to main web page 2018-01-10 19:42:20 +02:00
Jan Tuomi 9527e6de5f Skip pre-commit if virtualenv is not found 2017-11-26 00:10:46 +02:00
Jan Tuomi 86e2827f3b Merge branch 'develop' into 'master'
Develop

See merge request vtmk/web2.0!100
2017-11-25 23:37:45 +02:00
Jan Tuomi a519d51309 Fix style issues in kaehmy list 2017-11-25 23:29:20 +02:00
Jan Tuomi 9ee4d600a7 Update setup.sh 2017-11-25 22:18:41 +02:00
Jan Tuomi 2b2d635cb0 Update readme and pre-commit 2017-11-25 21:56:07 +02:00
Jan Tuomi ec6051d3d6 Add pre-commit hook 2017-11-25 21:49:30 +02:00
Jan Tuomi 5479f0e1a7 Merge branch 'develop' into 'master'
Develop

Closes #87

See merge request vtmk/web2.0!99
2017-11-08 18:20:08 +02:00
Jan Tuomi c219f32266 Merge branch 'develop' into 'master'
Develop

See merge request vtmk/web2.0!98
2017-11-04 20:04:38 +02:00
Jan Tuomi e111d1884c Merge branch 'develop' into 'master'
Develop

Closes #91

See merge request vtmk/web2.0!96
2017-11-01 14:22:31 +02:00
Jan Tuomi 7554750883 Merge branch 'develop' into 'master'
Split board and non-board applications to 2 tables

See merge request vtmk/web2.0!89
2017-10-30 14:50:55 +02:00
Jan Tuomi e75f0cfc67 Merge branch 'develop' into 'master'
Develop

See merge request vtmk/web2.0!88
2017-10-30 13:33:07 +02:00
Jan Tuomi 7d3208651a Merge branch 'develop' into 'master'
Fix multiple form and table issues

See merge request vtmk/web2.0!87
2017-10-29 12:25:12 +02:00
Jan Tuomi e949e93799 Merge branch 'develop' into 'master'
Hotfix

See merge request vtmk/web2.0!86
2017-10-26 13:52:36 +03:00
Jan Tuomi f544cf6183 Merge branch 'develop' into 'master'
Fix even more CI

See merge request vtmk/web2.0!85
2017-10-25 22:45:51 +03:00
Jan Tuomi 197c7b0a8b Merge branch 'develop' into 'master'
Fix more Gitlab CI

See merge request vtmk/web2.0!84
2017-10-25 22:36:15 +03:00
Jan Tuomi abb3f6659d Merge branch 'develop' into 'master'
Fix typo in .gitlab-ci.yml

See merge request vtmk/web2.0!83
2017-10-25 22:21:19 +03:00
Jan Tuomi 8141ccfa13 Merge branch 'develop' into 'master'
Develop

Closes #78

See merge request vtmk/web2.0!82
2017-10-25 22:08:02 +03:00
Jan Tuomi f395e8de06 Merge branch 'develop' into 'master'
Fix newlines in comments and sort filter values

See merge request vtmk/web2.0!79
2017-10-23 15:51:32 +03:00
Jan Tuomi 7614c127ba Merge branch 'develop' into 'master'
Update kaehmyopas

See merge request vtmk/web2.0!78
2017-10-20 17:46:25 +03:00
Jan Tuomi b2cc29f6af Merge branch 'develop' into 'master'
Add custom kaehmys to filter list

See merge request !77
2017-10-19 20:02:02 +03:00
Jan Tuomi 7efb8d3e7b Merge branch 'develop' into 'master'
Add translation for role models and remove summary field from PresetRole

See merge request !76
2017-10-19 14:26:35 +03:00
Jan Tuomi 48fa13e37b Merge branch 'develop' into 'master'
Develop

See merge request !75
2017-10-18 12:17:03 +03:00
Jan Tuomi d5ead73869 Merge branch 'develop' into 'master'
Also list custom roles in kaehmy form

See merge request !74
2017-10-17 21:48:46 +03:00
Jan Tuomi a81f305e54 Merge branch 'develop' into 'master'
Add tooltip about kaehmys to statistics page

See merge request !73
2017-10-17 21:15:13 +03:00
Jan Tuomi dcef7aa49a Merge branch 'develop' into 'master'
Fix footer styles on Safari

See merge request !72
2017-10-17 20:38:57 +03:00
Jan Tuomi e0f571a201 Merge branch 'develop' into 'master'
Develop

See merge request !71
2017-10-17 20:30:25 +03:00
Jan Tuomi e5e9774681 Merge branch 'develop' into 'master'
Fix typo

See merge request !70
2017-10-17 13:33:26 +03:00
Jan Tuomi 6f18fa0aea Merge branch 'develop' into 'master'
Develop

See merge request !69
2017-10-17 13:31:04 +03:00
Jan Tuomi 9a918da2f0 Merge branch 'develop' into 'master'
Fix tooltip styles

See merge request !68
2017-10-17 13:07:38 +03:00
Jan Tuomi 17d1d4fea2 Merge branch 'develop' into 'master'
Develop

See merge request !67
2017-10-17 12:48:54 +03:00
Jan Tuomi 85fcf6feb9 Merge branch 'develop' into 'master'
Implement nice navbar styles

See merge request !66
2017-10-16 18:42:18 +03:00
Jan Tuomi 89665d2b48 Merge branch 'develop' into 'master'
Edit labels on form fields

See merge request !65
2017-10-16 18:13:39 +03:00
Jan Tuomi c3478ff47c Merge branch 'develop' into 'master'
Develop

See merge request !64
2017-10-16 17:42:00 +03:00
Jan Tuomi b77dd3f50e Merge branch 'develop' into 'master'
Fix tg posting problem

See merge request !63
2017-10-16 14:42:28 +03:00
Jan Tuomi 7009f38652 Merge branch 'develop' into 'master'
Make form nicer

See merge request !62
2017-10-16 14:17:11 +03:00
Jan Tuomi 4ff426327b Merge branch 'develop' into 'master'
Fix kaehmy form error

See merge request !61
2017-10-16 12:43:43 +03:00
Jan Tuomi d7d0b377f2 Merge branch 'develop' into 'master'
Add category to role model

See merge request !60
2017-10-16 12:42:36 +03:00
Jan Tuomi 4f499af4cf Merge branch 'develop' into 'master'
Develop

See merge request !59
2017-10-16 11:23:05 +03:00
Jan Tuomi d9ed6e7b17 Merge branch 'develop' into 'master'
Develop

See merge request !58
2017-10-16 11:14:04 +03:00
Jan Tuomi efbfe64d1e Merge branch 'develop' into 'master'
Kaehmy

See merge request !56
2017-10-12 10:30:02 +03:00
Jan Tuomi cc9794d6a8 Merge branch 'develop' into 'master'
Fix pagination for 'add many' confirm view

See merge request !55
2017-10-03 14:40:29 +03:00
Jan Tuomi 19ff70d0bd Merge branch 'develop' into 'master'
Develop

See merge request !54
2017-10-02 21:07:34 +03:00
Jan Tuomi d82e3ec4d9 Merge branch 'develop' into 'master'
Develop

See merge request !52
2017-09-26 15:39:43 +03:00
Jan Tuomi d0825e96bc Merge branch 'develop' into 'master'
Fix search logic for full names

See merge request !51
2017-09-25 23:33:05 +03:00
Jan Tuomi a981f6a31f Merge branch 'develop' into 'master'
Search bar implementation

See merge request !50
2017-09-25 22:49:13 +03:00
Jan Tuomi 524c6bbb9e Merge branch 'develop' into 'master'
Fix for NaN message when coffee is brewing

See merge request !49
2017-09-25 12:21:19 +03:00
Jan Tuomi ac4902f867 Merge branch 'develop' into 'master'
Develop

See merge request !48
2017-09-24 16:31:08 +03:00
Jan Tuomi 416be8e2cd Merge branch 'develop' into 'master'
Develop

See merge request !47
2017-09-24 15:05:46 +03:00
Jan Tuomi 4cee5582da Merge branch 'develop' into 'master'
Develop

See merge request !46
2017-09-20 23:47:25 +03:00
Jan Tuomi 160f5adc59 Merge branch 'develop' into 'master'
Add filtering to coffee data

See merge request !43
2017-09-19 21:05:07 +03:00
Jan Tuomi b8267e411c Merge branch 'develop' into 'master'
Fix logging in all modules

See merge request !42
2017-09-19 19:32:06 +03:00
Jan Tuomi ab2fcf04eb Merge branch 'develop' into 'master'
Attempt to hotfix coffee scale crash

See merge request !41
2017-09-19 17:02:36 +03:00
Jan Tuomi 4a79ed341e Merge branch 'develop' into 'master'
Develop

See merge request !40
2017-09-19 00:06:29 +03:00
Jan Tuomi 7b8c5f3d8f Merge branch 'develop' into 'master'
Move coffee scale to web2.0

See merge request !39
2017-09-18 23:17:11 +03:00
Jan Tuomi 170635a8db Merge branch 'develop' into 'master'
Fix translation import issue

See merge request !38
2017-09-18 20:21:58 +03:00
Jan Tuomi a86f71b422 Merge branch 'develop' into 'master'
Develop

Closes #71 and #72

See merge request !37
2017-09-18 19:10:09 +03:00
Jan Tuomi 2585c4885b Merge branch 'develop' into 'master'
Develop

Closes #54

See merge request !34
2017-06-01 19:47:59 +03:00
Jan Tuomi 1cba13f4ff Merge branch 'develop' into 'master'
Develop

See merge request !33
2017-05-27 14:32:55 +03:00
Jan Tuomi 63e669ff0c Merge branch 'develop' into 'master'
HSL fix to master

See merge request !30
2017-05-27 12:40:35 +03:00
Jan Tuomi 2d95dbb0f1 Merge branch 'develop' into 'master'
Add about.html because Jopi forgot

See merge request !29
2017-05-24 20:12:46 +03:00
Jan Tuomi 8f50a6e0bf Merge branch 'develop' into 'master'
Develop

Closes #49, #5, #48, and #50

See merge request !28
2017-05-24 19:44:46 +03:00
438 changed files with 18713 additions and 6750 deletions
+8
View File
@@ -1,3 +1,11 @@
[report]
show_missing = True
omit =
*/migrations/*
*/admin.py
*/translation.py
[run]
omit =
*/migrations/*
*/admin.py
*/translation.py
-16
View File
@@ -1,16 +0,0 @@
#!/bin/bash
echo "Deploying to development."
set -e
set -x
pushd deployment
docker-compose down
docker pull "$1"
docker-compose up -d
popd
set +x
set +e
+32
View File
@@ -0,0 +1,32 @@
.DS_Store
.dockerignore
.git/
.husky/
.venv/
.vscode/
collected_static/
logs/
!logs/README
media/
!media/REMOVE_ME
misc/
node_modules/
scripts/
.coverage
.coveragerc
.env*
.eslintignore
.eslintrc.json
.gitignore
.gitlab-ci.yml
.python-version
docker-compose.yml
!manage.py
package*.json
!poetry.lock
!production_entrypoint.sh
pycodestyle.cfg
!pyproject.toml
pyright.json
README.md
stack-compose*.yml
+11
View File
@@ -0,0 +1,11 @@
DEPLOY_ENV=local
SENTRY_DSN=
HOST=api.dev.sahkoinsinoorikilta.fi
DEBUG=True
SECRET_KEY=7p$85^4ibb^p4-=vs44b7!y0e-zemugze18@a#30&71=a8)dp(
DB_NAME=postgres
DB_USER=postgres
DB_PASSWD=postgres
DB_HOST=db
DB_PORT=5432
EMAIL_API_KEY=
+13
View File
@@ -0,0 +1,13 @@
DEPLOY_ENV=local
#SENTRY_DSN=
HOST=localhost
DEBUG=True
SECRET_KEY=7p$85^4ibb^p4-=vs44b7!y0e-zemugze18@a#30&71=a8)dp(
DB_NAME=postgres
DB_USER=postgres
DB_PASSWD=postgres
DB_HOST=db
DB_PORT=5432
EMAIL_API_KEY=
GROUP_KEY=
GOOGLE_CREDS='{}'
+1
View File
@@ -3,3 +3,4 @@ infoscreen/static/js/lib
webapp/static/js/lib
static/js/lib
collected_static
venv
+4 -5
View File
@@ -4,11 +4,10 @@
"jquery": true
},
"globals": {
"angular": 1,
"noty": 1,
"app": 1,
"_": 1,
"moment": 1
"angular": true,
"noty": true,
"_": true,
"moment": true
},
"extends": "eslint:recommended",
"rules": {
+12 -18
View File
@@ -1,20 +1,14 @@
*.swp
sikweb/settings.py
*~
.DS_Store
.env
*.pyc
*.sqlite3
uwsgi.ini
uwsgi.log
infoscreen/static/js/hsl.json
members/logs/*
.idea/
logs/
/media/
node_modules/
/.coverage
db.sqlite3
requirements_henu.txt
/collected_static/
mydatabase
settings.json
.vscode/
/media/
logs/
members/logs/*
node_modules/
.coverage
.vscode/
.idea/
*.code-workspace
venv/
.venv/
+88 -58
View File
@@ -1,101 +1,131 @@
stages:
- test
- setup
- audit
- lint
- test
- publish
- deploy
install:
image: node:16
stage: setup
script:
- npm ci
artifacts:
paths:
- node_modules
expire_in: 1 week
audit:
image: python:3.9
stage: audit
needs: []
before_script:
- pip install poetry==1.1.13
- poetry config virtualenvs.create false
- poetry install --no-interaction --no-ansi
script:
- safety check
test:
image: python:3.5
image: python:3.9
stage: test
needs: []
services:
- postgres:latest
- postgres:12
variables:
POSTGRES_DB: ci
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB"
DB_HOST: postgres
before_script:
- pip install poetry==1.1.13
- poetry config virtualenvs.create false
- poetry install --no-interaction --no-ansi
script:
- python -V
- pip install -r requirements.txt
- cp sikweb/settings-sample.py sikweb/default_settings.py
- cp sikweb/.ci-settings.py sikweb/settings.py
- python manage.py migrate --noinput
- python manage.py createdefaultadmin
- python manage.py test
pycodestyle:
image: python:3.5
lint:py:
image: python:3.9
stage: lint
needs: []
script:
- pip install pycodestyle
- pycodestyle --config=setup.cfg --count .
- pip install black==22.3.0
- black --check .
eslint:
image: node:7.10.0
lint:js:
image: node:16
stage: lint
before_script:
- npm install
needs: ["install"]
script:
- npm run eslint
- npm run lint:js
remark:
image: node:7.10.0
lint:md:
image: node:16
stage: lint
before_script:
- npm install
needs: ["install"]
script:
- npm run remark
- npm run lint:md
publish:
stage: publish
image: docker:latest
image: docker:stable
needs: ["test", "lint:py", "lint:js", "lint:md"]
services:
- docker:stable-dind
only:
- develop
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $REGISTRY_URL
- master
script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build . -t "$IMAGE_NAME"
- docker push "$IMAGE_NAME"
deploy_dev:
deploy:dev:
stage: deploy
image: alpine:latest
environment:
name: dev
url: http://web.sik.party:8080
image: docker:stable
only:
- develop
before_script:
- pwd
- apk add --update openssh
- ssh -V
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- scp docker-compose.yml $DEV_SSH_USER@$DEV_SSH_HOST:~/deployment/docker-compose.yml
- scp .deploy_dev.sh $DEV_SSH_USER@$DEV_SSH_HOST:~/deployment/deploy_dev.sh
- ssh $DEV_SSH_USER@$DEV_SSH_HOST "bash ~/deployment/deploy_dev.sh \"$IMAGE_NAME\""
deploy_production:
stage: deploy
image: alpine:latest
environment:
name: production
url: https://sika.sahkoinsinoorikilta.fi
when: manual
name: dev
url: http://api.dev.sahkoinsinoorikilta.fi
variables:
DOCKER_HOST: $DEV_CI_DOCKER_HOST
DOCKER_TLS_VERIFY: 1
before_script:
- mkdir -p ~/.docker
- echo "$DEV_TLSCACERT" > ~/.docker/ca.pem
- echo "$DEV_TLSCERT" > ~/.docker/cert.pem
- echo "$DEV_TLSKEY" > ~/.docker/key.pem
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
script:
- docker stack deploy --with-registry-auth -c stack-compose-dev.yml "$SERVICE_NAME"
after_script:
- docker logout "$CI_REGISTRY"
deploy:production:
stage: deploy
image: docker:stable
only:
- master
environment:
name: production
url: https://api.sahkoinsinoorikilta.fi
when: manual
variables:
DOCKER_HOST: $CI_DOCKER_HOST
DOCKER_TLS_VERIFY: 1
before_script:
- pwd
- apk add --update openssh
- ssh -V
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- mkdir -p ~/.docker
- echo "$TLSCACERT" > ~/.docker/ca.pem
- echo "$TLSCERT" > ~/.docker/cert.pem
- echo "$TLSKEY" > ~/.docker/key.pem
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
script:
- ssh $PROD_SSH_USER@$PROD_SSH_HOST "zsh ~/deploy.sh"
- docker stack deploy --with-registry-auth -c stack-compose.yml "$SERVICE_NAME"
after_script:
- docker logout "$CI_REGISTRY"
+1
View File
@@ -0,0 +1 @@
_
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
PURPLE='\033[0;35m'
NC='\033[0m' # No Color
. "${VIRTUAL_ENV}/bin/activate"
if [ $? -ne 0 ]
then
printf "${PURPLE}Failed to find virtualenv. Skipping pre-commit hook.\n${NC}"
exit 0
fi
npm run lint
+24
View File
@@ -0,0 +1,24 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
PURPLE='\033[0;35m'
NC='\033[0m' # No Color
. "${VIRTUAL_ENV}/bin/activate"
if [ $? -ne 0 ]
then
printf "${PURPLE}Failed to find virtualenv. Skipping pre-push hook.\n${NC}"
exit 0
fi
set -e
printf "${PURPLE}Running pre-push tests.${NC}\n"
printf "${PURPLE}linters...${NC}\n"
npm run lint
printf "${PURPLE}unit tests...${NC}\n"
python -Wall manage.py test --noinput
set +e
printf "${PURPLE}Tests passed.${NC}\n"
+1
View File
@@ -0,0 +1 @@
16
+1
View File
@@ -0,0 +1 @@
3.9
-1
View File
@@ -1 +0,0 @@
global_static
+27 -7
View File
@@ -1,8 +1,28 @@
FROM python:3
FROM python:3.9-slim-buster as builder
ENV PYTHONUNBUFFERED 1
ENV IS_DOCKER 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN env
ADD . /code/
COPY . ./
ENV POETRY_VERSION=1.1.13
RUN pip install "poetry==$POETRY_VERSION"
RUN poetry export --without-hashes > requirements.txt
FROM python:3.9-slim-buster as server
WORKDIR /app
COPY . ./
COPY --from=builder requirements.txt ./
ENV PYTHONUNBUFFERED=1 \
# prevents python creating .pyc files
PYTHONDONTWRITEBYTECODE=1 \
# pip
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100
RUN apt-get update && apt-get install --no-install-recommends -y build-essential
RUN pip install --no-deps -r requirements.txt
RUN python manage.py collectstatic --noinput
CMD ["sh", "-c", "./production_entrypoint.sh"]
+59 -43
View File
@@ -16,77 +16,89 @@ Data table app for viewing and modifying the member register, member application
Mostly static website with an event calendar and news feed.
### Coffee scale
Shows the current coffee scale status.
## Accessing the source
### Clone this repository and enter it
Set up your SSH key authentication in GitLab Profile Settings. Then clone the repository and checkout the development branch:
```
git clone git@git.sahkoinsinoorikilta.fi:vtmk/web2.0.git
cd web2.0
```bash
git clone git@gitlab.com:sahkoinsinoorikilta/vtmk/web2.0-backend.git
cd web2.0-backend
git checkout develop
```
## Windows install instructions
## Development
See [Windows install instructions](./windows_install.md)
### Poetry
## Linux/Mac install instructions
For depedencies and virtual environment, we use [poetry](https://python-poetry.org/).
See [Linux/Mac install instructions](./linux_install.md)
```bash
python3 -m pip install poetry
```
## Initializing data
The easiest integration with VSCode is to have poetry install virtual environment in project folder, configured with CMD
```bash
python3 -m poetry config virtualenvs.in-project true
```
Start developing by install dependencies first
#### CMDs
Activate virtual environment in shell
```bash
python3 -m poetry shell
```
Install dependencies
```bash
poetry install
```
### npm scripts
We use Node.js for few development tasks, like linting. Easiest way to install Node is [nvm](https://github.com/nvm-sh/nvm).
TODO: List scripts
### Initializing data
Run the following `manage.py` commands. Do not run these in production without thinking!
```
```bash
python manage.py createdefaultadmin # creates an admin user
python manage.py initialize # creates user groups
python manage.py createdummydata # creates dummy members to the member register
```
## Running
### Running
### Use runserver command
```
python manage.py runserver 0.0.0.0:8000
```bash
python manage.py runserver
```
Using address `0.0.0.0` will bind to all IP addresses. Using `localhost` will only bind to your machine.
### Visit the page
#### Visit the page
Visit [https://localhost:8000](https://localhost:8000) in your browser!
## Running in production
Using address `0.0.0.0` will bind to all IP addresses. Using `localhost` will only bind to your machine.
Run the project in production with gunicorn. Refer to [this page](https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04) for instructions.
Install production dependencies.
```
pip install -r requirements.production.txt
```bash
python manage.py runserver 0.0.0.0:8000
```
## Development workflow
When pulling changes from the server, use `rebase` instead of `merge` for a nice and clean linear history.
Example of pulling with rebase:
```
git pull --rebase
```
### Development workflow
When you start working on a feature, create a feature branch for your changes. These feature branches should be prefixed with `feature`.
Example of creating a feature branch:
```
```bash
git checkout -b feature-error-page
```
@@ -100,13 +112,13 @@ Merge requests to `master` should be reviewed by multiple developers. Only a mod
Lint python files using `pycodestyle` with
```
pycodestyle --config=setup.cfg --count .
```bash
pycodestyle --config=pycodestyle.cfg --count .
```
Lint javascript and markdown using `eslint` and `remark` with
```
```bash
npm test
```
@@ -116,14 +128,18 @@ Use an editor with linting capabilities to write pretty code that passes linting
Run unit tests with
```
python manage.py test -v 2
```bash
python manage.py test
```
Due to the mostly static nature of the project, most elements are difficult to properly unit test. If you write code with actual logic, make sure to write at least one unit or integration test that tests your code's core functionality.
Tests are located in `tests.py` under every subproject.
### GitLab CI
## Production
Project is run in production with Docker. See `Dockerfile` for details.
## GitLab CI
All pushed changes go through the GitLab Continuous Integration, which consists of automated unit testing and linting. Make sure your changes pass both before merging to `develop` or `master`.
-3
View File
@@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.
-3
View File
@@ -1,3 +0,0 @@
from django.db import models
# Create your models here.
-124
View File
@@ -1,124 +0,0 @@
body {
background-color: white;
font-family: monospace;
color: black;
}
#container{
position:relative;
width:95%;
margin-left:auto;
margin-right:auto;
height:100%;
overflow:hidden;
}
#upper{
background-size: contain;
background-repeat: no-repeat;
background-position: bottom center;
background-image: url("/static/img/smokes.png");
transform-origin: bottom;
animation: smokes 8s ease-in-out 0s infinite;
opacity:0;
height:40%;
}
#lower{
position:relative;
background-size: contain;
background-repeat: no-repeat;
background-position: top center;
background-image: url("/static/img/coffeecup3.png");
height:60%;
}
#scale{
position:absolute;
top:80%;
width:90%;
height:10%;
margin: 0% 5% 0% 5%;
background: lightgrey;
border-radius: 10px;
overflow:hidden;
}
#scale2{
width: 0%;
transition: width 2s;
height:100%;
background: green;
border-radius: 10px;
}
.brewtime{
text-align:right;
position:absolute;
right:0px;
z-index:5;
font-size:10vw;
}
#address{
text-align:left;
position:absolute;
left:0px;
z-index:5;
font-size:4vw;
color: #333;
}
.layertwo{
display: None;
}
noscript{
color:red;
}
.text{
color:green;
position:absolute;
top:50%;
left:50%;
}
.brewing{
animation: brewing 5s ease-in-out 0s infinite;
}
.hurry{
color:red !important;
}
.unknown{
color:orange !important;
animation: unknown 5s ease-in-out 0s infinite;
}
.friday{
animation: friday 20s ease-in-out 0s infinite;
}
.normal{
animation: normal 1000s ease-in-out 0s infinite;
}
.coffeeready{
animation: coffeeready 10s ease-in-out 0s;
}
@keyframes smokes {
0% {transform: skewX(-10deg);}
50% {transform: skewX(10deg);}
100% {transform: skewX(-10deg);}
}
@keyframes brewing {
0% {color:green;}
50% {color: transparent;}
100% {color:green;}
}
@keyframes coffeeready {
0% {background-color:white;}
25% {background-color:rgb(100, 255, 100);}
50% {background-color:white;}
75% {background-color:rgb(100, 255, 100);}
100% {background-color:white;}
}
@keyframes unknown {
0%,40% {transform: rotate(0deg);}
60%,100% {transform: rotate(360deg);}
}
@keyframes friday {
0% {transform: rotate(0deg);}
100% {transform: rotate(360deg);}
}
@keyframes normal {
0%,49% {transform: rotate(0deg);}
50%,100% {transform: rotate(360deg);}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

-183
View File
@@ -1,183 +0,0 @@
//Inner state
var lastBrew = new Date(0);
var brewing = false;
var backoff = 2000;
//MQTT client config
var username = "coffee-user-"+ Math.random();
// eslint-disable-next-line no-undef
var client = new Paho.MQTT.Client("sika.sahkoinsinoorikilta.fi", 9001, username);
client.onMessageArrived = function (message) {
// eslint-disable-next-line no-console
console.log("Topic: "+message.destinationName+" msg: "+message.payloadString);
var ev = new CustomEvent(message.destinationName, {'detail': message.payloadString});
window.dispatchEvent(ev);
}
function reconnect(responseObject){
if (responseObject.errorCode !== 0) {
console.log("connection lost! Reason: "+responseObject.errorMessage); // eslint-disable-line no-console
setTimeout(function(){
client.connect({onSuccess:onConnect, useSSL:true, onFailure: reconnect});
}, backoff);
}
}
function onConnect() {
console.log("MQTT connected"); // eslint-disable-line no-console
//set and reset reconnector
client.onConnectionLost = reconnect
// subscribe to topics
client.subscribe("sik/kiltahuone/kahvivaaka/cups");
client.subscribe("sik/kiltahuone/kahvivaaka/brewing");
client.subscribe("sik/kiltahuone/kahvivaaka/brewtime");
}
// data update and parse functions
function parseCups(ev){
var cups = parseFloat(ev.detail).toFixed(1)
function makeEvent(cups) {
return (String(cups) !== '-1.0')
? new CustomEvent("cupsChanged", {'detail': cups})
: new CustomEvent("cupsError", {'detail': 'Error: unable to fetch cups :('});
}
window.dispatchEvent(makeEvent(cups));
}
function updateCups(ev){
$("#text").text(ev.detail);
}
function showCupsError(ev) {
$('#text').text(ev.detail);
$('#text').css({
'font-size': '7vh',
'left': '0',
'top': '40%',
'width': '100%',
'text-align': 'center',
'color': 'red',
});
$('#lower').css({'background-image': 'none'});
}
function updateScale(ev){
$("#scale2").css({width: Math.min(ev.detail/9*100,100) + '%'});
}
function tick(){
var ev = new CustomEvent("tick", {'detail': new Date()});
window.dispatchEvent(ev);
}
function updateTime(ev){
var now = ev.detail;
$("#time").html(formatTime(now.getHours(),now.getMinutes(),now.getSeconds()));
}
function coffeeLowEffect(ev){
ev.detail <= 2 ? $("#text").addClass("hurry") : $("#text").removeClass("hurry");
}
function coffeeReadyEffect(){
$("body").addClass("coffeeready");
// autoclear animation class in 10s
setTimeout(function(){$("body").removeClass("coffeeready");}, 10000);
}
function hotEffect(ev){
var opa = Math.max(100 - ev.detail / 90000,0);
$("#upper").css({opacity: opa/100});
}
function brewAnimStart(){
$(".text").addClass("brewing");
$(".layerone").hide();
$(".layertwo").show();
}
function brewAnimEnd(){
$(".text").removeClass("brewing");
$(".layertwo").hide();
$(".layerone").show();
}
function brewNotifier(ev){
var new_brewing = parseInt(ev.detail);
if (new_brewing == 1 && brewing == 0){
window.dispatchEvent(new Event("brewStart"));
} else if (new_brewing == 0 && brewing == 1){
window.dispatchEvent(new Event("brewEnd"));
}
brewing = new_brewing;
}
function brewTimeParser(ev){
lastBrew = new Date(parseInt(ev.detail)*1000.0);
}
function updateBrewDiff(){
var now = new Date();
var timeDiff = Math.max(now.getTime() - lastBrew.getTime(), 0);
var eve = new CustomEvent("dtUpdate", {'detail': timeDiff});
window.dispatchEvent(eve);
}
function updateBrewTime(ev){
var timeDiff = ev.detail;
var timeStr;
if (timeDiff < 3600000){
timeStr = Math.round(timeDiff / 60000) + ' min'
} else if (timeDiff < 10000* 3600 * 1000){ // 1000h
timeStr = '~' + Math.round(timeDiff / 3600000 * 2) / 2 + ' h';
} else {
timeStr = "???"
}
$("#brewtime").html(timeStr);
}
// Helpers
function nToS(num){
return num < 10 ? "0" + num : "" + num;
}
function formatTime(hours, minutes, seconds){
return nToS(hours)+":"+nToS(minutes)+":"+nToS(seconds)
}
function resize(){
var w = $("#container").width();
var h = $("#container").height();
var s = w > h ? h : w;
var font = s * 0.8 * 0.38/Math.sqrt(3);
$(".text").css({ top: s*0.16-font/2 + 'px',
fontSize: font + 'px',
marginLeft: -font*3*3/10 + 'px'});
}
// Init everything
$(document).ready(function(){
client.connect({onSuccess:onConnect, useSSL:true, onFailure:reconnect});
//connect MQTT event listeners
window.addEventListener("sik/kiltahuone/kahvivaaka/cups", parseCups);
window.addEventListener("sik/kiltahuone/kahvivaaka/brewing", brewNotifier);
window.addEventListener("sik/kiltahuone/kahvivaaka/brewtime", brewTimeParser);
//connect other event listeners
window.addEventListener("cupsChanged", updateCups);
window.addEventListener("cupsChanged", coffeeLowEffect);
window.addEventListener("cupsChanged", updateScale);
window.addEventListener("cupsChanged", resize);
window.addEventListener("cupsError", showCupsError);
window.addEventListener("cupsError", coffeeLowEffect);
window.addEventListener("cupsError", updateScale);
window.addEventListener("brewStart", brewAnimStart);
window.addEventListener("brewEnd", brewAnimEnd);
window.addEventListener("brewEnd", coffeeReadyEffect);
window.addEventListener("tick", updateTime);
window.addEventListener("tick", updateBrewDiff);
window.addEventListener("dtUpdate", updateBrewTime);
window.addEventListener("dtUpdate", hotEffect);
//start time based events
setInterval(tick, 100);
tick();
});
$(window).resize(resize);
-38
View File
@@ -1,38 +0,0 @@
<html>
<head>
<title>Coffee Cups @Guild Room - AYY SIK ry</title>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="3600">
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.2/mqttws31.js"
type="text/javascript"></script>
<link rel="stylesheet" href="/static/css/coffee.css" />
<script src="/static/js/coffee.js"></script>
</head>
<body>
<div id="container">
<span id="brewtime" class="brewtime layerone"></span>
<span class="brewtime layertwo">:)</span>
<span id="address">
ka.dy.fi
<noscript><br>This page uses JavaScript!</noscript>
<br><span id="time"></span></span>
</span>
<div id="upper">
</div>
<!--Kahvinkeitin on rikki. Varakeittimellä keitettyä kahvia saattaa olla.-->
<div id="lower" class="normal">
<div id="text" class="text layerone">???</div>
<div class="text layertwo">&nbsp;+</div>
<div id="scale"><div id="scale2"></div></div>
</div>
</div>
</body>
</html>
-2
View File
@@ -1,2 +0,0 @@
from django.test import TestCase, Client
from django.conf import settings
-12
View File
@@ -1,12 +0,0 @@
from django.conf.urls import url
from django.views.generic.base import RedirectView
from .views import coffee_view
favicon_view = RedirectView.as_view(url='static/img/favicon.ico', permanent=True)
urlpatterns = [
# landing page
url(r'^$', coffee_view),
]
-11
View File
@@ -1,11 +0,0 @@
from django.shortcuts import render
from django.http import JsonResponse
from django.utils import timezone
import logging
from django.conf import settings
def coffee_view(request):
return render(request, 'coffee.html')
+15 -4
View File
@@ -2,12 +2,23 @@ version: '3'
services:
db:
image: postgres
image: postgres:12
volumes:
- dbdata:/var/lib/postgresql/data
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=postgres
web:
build: .
image: git.sahkoinsinoorikilta.fi:4567/vtmk/web2.0
command: ["bash", "-c", "cd /code && ./wait-for-it.sh db:5432 -- bash setup.sh --no-input --no-npm && python manage.py runserver 0.0.0.0:8080"]
image: registry.gitlab.com/sahkoinsinoorikilta/vtmk/web2.0-backend
env_file:
- .env
ports:
- "8080:8080"
- "8000:8000"
depends_on:
- db
volumes:
dbdata:
-45
View File
@@ -1,45 +0,0 @@
# Ilmotunkki
## Terms
- Signup, Form with collection of questions
- Response, One answer to some signup
- Quota, Amount of people allowed to respond with some option selected.
- In generic case there is no option and quota is just max number of people.
## Requirements
- Officials may generate signups forms
- Officials may see results from signups
- Officials may see some stats from their signups
- for example distributions of multiple choice answers
- Officials should be able to edit signups wherever possible
- Propably not possible to edit after first response
- Officials should be able to delete responses
- Officials should be able to embed payment information to the signup?
- TODO: is there need for unique reference numbers for every response?
- Officials should be able to save a signup to a reusable template.
- Signup may be attached to an event
- multiple signups to a single event?
- Signup should support custom quotas
- Atleast quotas from multiple choices and checkboxes
- Text quotas are risky (typos everywhere!!)
- Signup should have start and end times
- signup should support atleast following questiontypes
- Text
- multiple choice (select one)
- checkbox (boolean yes/no)
- Signup should support reserve slots.
TODO: quota based reserves or generic? or both?
- Responding should send confirm email
- Response should be editable by responder and only by the responder until the closing of the signup
- TODO: is there need to custom edit period or disable?
- Responders should see amount of quotas left.
- Responders should see some information about other responses
- TODO: names? should this be editable by officials?
- NOTE: Quota related info is exposed if any info is printed
-3
View File
@@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.
-5
View File
@@ -1,5 +0,0 @@
from django.apps import AppConfig
class IlmotunkkiConfig(AppConfig):
name = 'ilmotunkki'
-16
View File
@@ -1,16 +0,0 @@
from django.db import models
from django.utils import timezone
class Signup(models.Model):
start = models.DateTimeField()
end = models.DateTimeField()
class Question(models.Model):
pass
class Answer(models.Model):
signup = models.ForeignKey(Signup, on_delete=models.CASCADE)
question = models.ForeignKey(Question, on_delete=models.PROTECT)
-3
View File
@@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.
+10 -4
View File
@@ -1,10 +1,16 @@
"""Admin site registers."""
from django.contrib import admin
from infoscreen.models import Rotation, InfoItem, InfoInstance
from infoscreen.models import ImageInfoItem, ExternalImageInfoItem, ABBInfoItem
from infoscreen.models import ExternalWebsiteInfoItem
from infoscreen.models import VideoInfoItem
from infoscreen.models import (
Rotation,
InfoItem,
InfoInstance,
ImageInfoItem,
ExternalImageInfoItem,
ABBInfoItem,
ExternalWebsiteInfoItem,
VideoInfoItem,
)
# Register your models here.
admin.site.register(Rotation)
+1 -1
View File
@@ -6,4 +6,4 @@ from django.apps import AppConfig
class InfoscreenConfig(AppConfig):
"""Infoscreen app configuration."""
name = 'infoscreen'
name = "infoscreen"
-70
View File
@@ -1,70 +0,0 @@
"""File containing Infoscreen HSL data fetcher classes."""
import requests
import json
import logging
import os
import pytz
from datetime import timedelta, datetime
from django.utils import timezone, dateparse
from django.utils.dateformat import format
from django.conf import settings
with open(os.path.join(settings.BASE_DIR, 'infoscreen', 'hsl_stops.graphql')) as stops_file:
STOPS_QUERY = stops_file.read()
with open(os.path.join(settings.BASE_DIR, 'infoscreen', 'hsl_stops_variables.json')) as vars_file:
STOPS_VARS = json.loads(vars_file.read())
API_URL = 'https://api.digitransit.fi/routing/v1/routers/hsl/index/graphql'
API_HEADERS = {'Content-Type': 'application/json'}
def fetch():
"""Fetch data from HSL API."""
query_vars = STOPS_VARS.copy()
query_vars['startTime_6'] = format(timezone.now(), 'U')
post_data = json.dumps({
'operationName': 'NearestRoutesContainer',
'query': STOPS_QUERY,
'variables': query_vars,
})
resp = requests.post(API_URL, data=post_data, headers=API_HEADERS)
data = resp.json()
items = data['data']['viewer']['_nearest']['edges']
places = map(lambda item: item['node']['place'], items)
schedule = []
for place in places:
route = place['pattern']['route']['shortName']
stop_times = place['_stoptimes']
for stop_time in stop_times:
timestamp = time_utc = stop_time['serviceDay'] + stop_time['realtimeArrival']
headsign = stop_time['stopHeadsign']
stop_name = stop_time['stop']['name']
time_diff = (timestamp - timezone.now().timestamp()) / 60 # minutes
if time_diff < settings.HSL_DEPARTURE_THRESHOLD:
continue
elif time_diff < settings.HSL_HURRY_THRESHOLD:
time = '{} min'.format(int(time_diff))
else:
time = pytz.utc.localize(datetime.fromtimestamp(timestamp)).strftime('%H:%M')
schedule.append({
'route': route,
'headsign': headsign,
'timestamp': time,
'stop': stop_name,
'utc': time_utc,
})
return schedule
-71
View File
@@ -1,71 +0,0 @@
query NearestRoutesContainer($lat_0: Float!, $lon_1: Float!, $maxDistance_2: Int!, $maxResults_3: Int!, $timeRange_7: Int!, $numberOfDepartures_8: Int!, $filterByModes_4: [Mode]!, $filterByPlaceTypes_5: [FilterPlaceType]!, $startTime_6: Long!) {
viewer {
...F5
}
}
fragment F0 on DepartureRow {
_stoptimes4caEfh: stoptimes(startTime: $startTime_6, timeRange: $timeRange_7, numberOfDepartures: $numberOfDepartures_8) {
pickupType
serviceDay
realtimeDeparture
}
id
}
fragment F1 on DepartureRow {
pattern {
route {
shortName
}
}
_stoptimes: stoptimes(startTime: $startTime_6, timeRange: $timeRange_7, numberOfDepartures: $numberOfDepartures_8) {
realtimeArrival
serviceDay
stopHeadsign
stop {
name
}
}
}
fragment F2 on BikeRentalStation {
id
}
fragment F3 on placeAtDistance {
distance
place {
id
__typename
...F1
...F2
}
id
}
fragment F4 on placeAtDistanceConnection {
edges {
node {
distance
place {
id
__typename
...F0
}
id
...F3
}
cursor
}
pageInfo {
hasNextPage
hasPreviousPage
}
}
fragment F5 on QueryType {
_nearest: nearest(lat: $lat_0, lon: $lon_1, maxDistance: $maxDistance_2, maxResults: $maxResults_3, first: $maxResults_3, filterByModes: $filterByModes_4, filterByPlaceTypes: $filterByPlaceTypes_5) {
...F4
}
}
-10
View File
@@ -1,10 +0,0 @@
{
"lat_0": 60.190480099999995,
"lon_1": 24.8275665,
"maxDistance_2": 1000,
"maxResults_3": 50,
"numberOfDepartures_8": 2,
"timeRange_7": 7200,
"filterByModes_4": ["BUS"],
"filterByPlaceTypes_5": ["DEPARTURE_ROW"]
}
-10
View File
@@ -1,10 +0,0 @@
from django.core.management.base import BaseCommand
from infoscreen.hsl_fetcher import HSLFetcher
class Command(BaseCommand):
help = 'Loads HSL timetables and save to json file.'
def handle(self, *args, **options):
fetcher = HSLFetcher()
fetcher.fetch()
+128 -36
View File
@@ -11,81 +11,173 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
("contenttypes", "0002_remove_content_type_name"),
]
operations = [
migrations.CreateModel(
name='HSLDataModel',
name="HSLDataModel",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('data', models.TextField(default='', editable=False)),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("data", models.TextField(default="", editable=False)),
],
),
migrations.CreateModel(
name='InfoInstance',
name="InfoInstance",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('duration', models.FloatField(default=15.0)),
('item_id', models.PositiveIntegerField()),
('item_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("duration", models.FloatField(default=15.0)),
("item_id", models.PositiveIntegerField()),
(
"item_type",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="contenttypes.ContentType",
),
),
],
),
migrations.CreateModel(
name='InfoItem',
name="InfoItem",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('expire_date', models.DateTimeField(blank=True, null=True)),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=255)),
("expire_date", models.DateTimeField(blank=True, null=True)),
],
),
migrations.CreateModel(
name='Rotation',
name="Rotation",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='ABBInfoItem',
name="ABBInfoItem",
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')),
(
"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',),
bases=("infoscreen.infoitem",),
),
migrations.CreateModel(
name='ExternalImageInfoItem',
name="ExternalImageInfoItem",
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')),
('url', models.TextField()),
(
"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",
),
),
("url", models.TextField()),
],
bases=('infoscreen.infoitem',),
bases=("infoscreen.infoitem",),
),
migrations.CreateModel(
name='HslInfoItem',
name="HslInfoItem",
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')),
(
"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',),
bases=("infoscreen.infoitem",),
),
migrations.CreateModel(
name='ImageInfoItem',
name="ImageInfoItem",
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')),
('img', models.ImageField(upload_to='infoimages/')),
(
"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",
),
),
("img", models.ImageField(upload_to="infoimages/")),
],
bases=('infoscreen.infoitem',),
bases=("infoscreen.infoitem",),
),
migrations.CreateModel(
name='SossoInfoItem',
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')),
(
"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',),
bases=("infoscreen.infoitem",),
),
migrations.AddField(
model_name='infoinstance',
name='rotation',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='instances', to='infoscreen.Rotation'),
model_name="infoinstance",
name="rotation",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="instances",
to="infoscreen.Rotation",
),
),
]
+14 -4
View File
@@ -9,15 +9,25 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('infoscreen', '0001_initial'),
("infoscreen", "0001_initial"),
]
operations = [
migrations.CreateModel(
name='CoffeeInfoItem',
name="CoffeeInfoItem",
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')),
(
"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',),
bases=("infoscreen.infoitem",),
),
]
@@ -9,33 +9,63 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('infoscreen', '0002_coffeeinfoitem'),
("infoscreen", "0002_coffeeinfoitem"),
]
operations = [
migrations.CreateModel(
name='ApyInfoItem',
name="ApyInfoItem",
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')),
(
"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',),
bases=("infoscreen.infoitem",),
),
migrations.CreateModel(
name='EventInfoItem',
name="EventInfoItem",
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')),
(
"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',),
bases=("infoscreen.infoitem",),
),
migrations.CreateModel(
name='ExternalWebsiteInfoItem',
name="ExternalWebsiteInfoItem",
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')),
('url', models.TextField()),
(
"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",
),
),
("url", models.TextField()),
],
bases=('infoscreen.infoitem',),
bases=("infoscreen.infoitem",),
),
migrations.DeleteModel(
name='CoffeeInfoItem',
name="CoffeeInfoItem",
),
]
+15 -5
View File
@@ -9,16 +9,26 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('infoscreen', '0003_auto_20170329_1857'),
("infoscreen", "0003_auto_20170329_1857"),
]
operations = [
migrations.CreateModel(
name='VideoInfoItem',
name="VideoInfoItem",
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')),
('video', models.FileField(upload_to='infovideos/')),
(
"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",
),
),
("video", models.FileField(upload_to="infovideos/")),
],
bases=('infoscreen.infoitem',),
bases=("infoscreen.infoitem",),
),
]
@@ -8,18 +8,18 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('infoscreen', '0004_videoinfoitem'),
("infoscreen", "0004_videoinfoitem"),
]
operations = [
migrations.AlterField(
model_name='externalimageinfoitem',
name='url',
model_name="externalimageinfoitem",
name="url",
field=models.URLField(),
),
migrations.AlterField(
model_name='externalwebsiteinfoitem',
name='url',
model_name="externalwebsiteinfoitem",
name="url",
field=models.URLField(),
),
]
@@ -8,11 +8,14 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('infoscreen', '0005_auto_20170913_1841'),
("infoscreen", "0005_auto_20170913_1841"),
]
operations = [
migrations.DeleteModel(
name='HSLDataModel',
name="HSLDataModel",
),
migrations.DeleteModel(
name="HslInfoItem",
),
]
+31
View File
@@ -0,0 +1,31 @@
# Generated by Django 2.1.5 on 2019-03-26 12:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("infoscreen", "0006_delete_hsldatamodel"),
]
operations = [
migrations.CreateModel(
name="LunchItem",
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",),
),
]
@@ -0,0 +1,28 @@
# Generated by Django 3.2.14 on 2022-08-01 19:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("infoscreen", "0007_lunchitem"),
]
operations = [
migrations.AlterField(
model_name="infoinstance",
name="id",
field=models.AutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name="infoitem",
name="id",
field=models.AutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name="rotation",
name="id",
field=models.AutoField(primary_key=True, serialize=False),
),
]
+80 -84
View File
@@ -16,6 +16,7 @@ class InfoItem(models.Model):
class __meta__:
abstract = True
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=255)
# expire_date = None means never expiring item
expire_date = models.DateTimeField(blank=True, null=True)
@@ -23,14 +24,14 @@ class InfoItem(models.Model):
def get_template_url(self):
"""Get infoscreen template url."""
raise NotImplementedError(
"inheriting classes must implement get_template_url")
raise NotImplementedError("inheriting classes must implement get_template_url")
@staticmethod
def get_create_template_url():
"""Get create infoscreen template url command."""
raise NotImplementedError(
"inheriting classes must implement get_create_template_url")
"inheriting classes must implement get_create_template_url"
)
@classmethod
def create_from_dict(cls, d):
@@ -42,14 +43,13 @@ class InfoItem(models.Model):
def update_from_dict(self, d):
"""Update model based on given dict."""
try:
expire_date = d.pop('expire_date', None)
self.expire_date = datetime.strptime(
expire_date, "%Y-%m-%d %H:%M:%S")
expire_date = d.pop("expire_date", None)
self.expire_date = datetime.strptime(expire_date, "%Y-%m-%d %H:%M:%S")
except:
pass
dmap = {
'name': 'name',
"name": "name",
}
for k, v in d.items():
try:
@@ -61,13 +61,13 @@ class InfoItem(models.Model):
def get_dict(self):
"""Convert django model to dict and return it."""
return {
'id': self.id,
'name': self.name,
'item_type': ContentType.objects.get_for_model(self).id,
'template_url': self.get_template_url(),
'display_name': self.display_name,
'create_template_url': self.get_create_template_url(),
'options': {}
"id": self.id,
"name": self.name,
"item_type": ContentType.objects.get_for_model(self).id,
"template_url": self.get_template_url(),
"display_name": self.display_name,
"create_template_url": self.get_create_template_url(),
"options": {},
}
def delete(self):
@@ -75,8 +75,8 @@ class InfoItem(models.Model):
# since generic foreign keys suck, delete info
# items pointing here manually
InfoInstance.objects.filter(
item_id=self.id,
item_type=ContentType.objects.get_for_model(self)).delete()
item_id=self.id, item_type=ContentType.objects.get_for_model(self)
).delete()
super().delete()
@classmethod
@@ -98,12 +98,12 @@ class ABBInfoItem(InfoItem):
def get_template_url(self):
"""Return ABB infoitem template url."""
return "/static/html/abb.html"
return "/static/infoscreen/html/abb.html"
@staticmethod
def get_create_template_url():
"""Call create ABB infoitem template url command."""
return "/static/html/abb_create.html"
return "/static/infoscreen/html/abb_create.html"
class ApyInfoItem(InfoItem):
@@ -113,12 +113,12 @@ class ApyInfoItem(InfoItem):
def get_template_url(self):
"""Return APY infoitem template url."""
return "/static/html/apy.html"
return "/static/infoscreen/html/apy.html"
@staticmethod
def get_create_template_url():
"""Call create APY infoitem template url command."""
return "/static/html/apy_create.html"
return "/static/infoscreen/html/apy_create.html"
class ExternalWebsiteInfoItem(InfoItem):
@@ -129,17 +129,17 @@ class ExternalWebsiteInfoItem(InfoItem):
def get_template_url(self):
"""Return external website infoitem template url."""
return "/static/html/external_website.html?url={}".format(self.name)
return "/static/infoscreen/html/external_website.html?url={}".format(self.name)
@staticmethod
def get_create_template_url():
"""Call create external website infoitem template url command."""
return "/static/html/external_website_create.html"
return "/static/infoscreen/html/external_website_create.html"
def get_dict(self):
"""Convert django model to dict and return it."""
d = super().get_dict()
d["options"] = {'url': self.url}
d["options"] = {"url": self.url}
return d
@classmethod
@@ -152,23 +152,22 @@ class ExternalWebsiteInfoItem(InfoItem):
def get_list(self):
"""Return list containing infoitem data."""
return {
'id': self.id,
'name': self.name,
'url': self.url,
"id": self.id,
"name": self.name,
"url": self.url,
}
def update_from_dict(self, d):
"""Update model based on given dict."""
try:
expire_date = d.pop('expire_date', None)
self.expire_date = datetime.strptime(
expire_date, "%Y-%m-%d %H:%M:%S")
expire_date = d.pop("expire_date", None)
self.expire_date = datetime.strptime(expire_date, "%Y-%m-%d %H:%M:%S")
except:
pass
dmap = {
'name': 'name',
'url': 'url',
"name": "name",
"url": "url",
}
for k, v in d.items():
try:
@@ -185,12 +184,25 @@ class SossoInfoItem(InfoItem):
def get_template_url(self):
"""Return Sosso infoitem template url."""
return "/static/html/sosso.html"
return "/static/infoscreen/html/sosso.html"
@staticmethod
def get_create_template_url():
"""Call create Sosso infoitem template url command."""
return "/static/html/sosso_create.html"
return "/static/infoscreen/html/sosso_create.html"
class LunchItem(InfoItem):
"""Class for Lunch Infoscreen item."""
display_name = _("Today's lunch")
def get_template_url(self):
return "/static/infoscreen/html/lunch.html"
@staticmethod
def get_create_template_url():
return "/static/infoscreen/html/lunch_create.html"
class EventInfoItem(InfoItem):
@@ -200,12 +212,12 @@ class EventInfoItem(InfoItem):
def get_template_url(self):
"""Return Event infoitem template url."""
return "/static/html/events.html"
return "/static/infoscreen/html/events.html"
@staticmethod
def get_create_template_url():
"""Call create Event infoitem template url command."""
return "/static/html/events_create.html"
return "/static/infoscreen/html/events_create.html"
class ImageInfoItem(InfoItem):
@@ -218,57 +230,42 @@ class ImageInfoItem(InfoItem):
"""Return Image infoitem template url."""
# get param to avoid angular from optimizing same template
# with different options
return "/static/html/generic_image.html?img={}".format(self.name)
return "/static/infoscreen/html/generic_image.html?img={}".format(self.name)
@staticmethod
def get_create_template_url():
"""Call create Image infoitem template url command."""
return "/static/html/generic_image_create.html"
return "/static/infoscreen/html/generic_image_create.html"
def get_dict(self):
"""Convert django model to dict and return it."""
d = super().get_dict()
d["options"] = {'img': self.img.url}
d["options"] = {"img": self.img.url}
return d
class VideoInfoItem(InfoItem):
"""Class for Video Infoscreen item."""
display_name = ("Video")
display_name = "Video"
video = models.FileField(upload_to="infovideos/")
def get_template_url(self):
"""Return Video infoitem template url."""
return "/static/html/generic_video.html?video={}".format(self.name)
return "/static/infoscreen/html/generic_video.html?video={}".format(self.name)
@staticmethod
def get_create_template_url():
"""Call create Video infoitem template url command."""
return "/static/html/generic_video_create.html"
return "/static/infoscreen/html/generic_video_create.html"
def get_dict(self):
"""Convert django model to dict and return it."""
d = super().get_dict()
d["options"] = {'video': self.video.url}
d["options"] = {"video": self.video.url}
return d
class HslInfoItem(InfoItem):
"""Class for HSL Infoscreen item."""
display_name = _("HSL timetables")
def get_template_url(self):
"""Return HSL infoitem template url."""
return "/static/html/hsl.html"
@staticmethod
def get_create_template_url():
"""Call create HSL infoitem template url command."""
return "/static/html/hsl_create.html"
class ExternalImageInfoItem(InfoItem):
"""Class for External Image Infoscreen item."""
@@ -277,17 +274,17 @@ class ExternalImageInfoItem(InfoItem):
def get_template_url(self):
"""Return External Image infoitem template url."""
return "/static/html/generic_image.html?img={}".format(self.name)
return "/static/infoscreen/html/generic_image.html?img={}".format(self.name)
@staticmethod
def get_create_template_url():
"""Call create External Image infoitem template url command."""
return "/static/html/generic_external_image_create.html"
return "/static/infoscreen/html/generic_external_image_create.html"
def get_dict(self):
"""Convert django model to dict and return it."""
d = super().get_dict()
d["options"] = {'img': self.url}
d["options"] = {"img": self.url}
return d
@classmethod
@@ -300,15 +297,14 @@ class ExternalImageInfoItem(InfoItem):
def update_from_dict(self, d):
"""Update model based on given dict."""
try:
expire_date = d.pop('expire_date', None)
self.expire_date = datetime.strptime(
expire_date, "%Y-%m-%d %H:%M:%S")
expire_date = d.pop("expire_date", None)
self.expire_date = datetime.strptime(expire_date, "%Y-%m-%d %H:%M:%S")
except:
pass
dmap = {
'name': 'name',
'url': 'url',
"name": "name",
"url": "url",
}
for k, v in d.items():
try:
@@ -321,12 +317,15 @@ class ExternalImageInfoItem(InfoItem):
class InfoInstance(models.Model):
"""Class for Info instance in Infoscreen."""
rotation = models.ForeignKey('Rotation', related_name='instances')
id = models.AutoField(primary_key=True)
rotation = models.ForeignKey(
"Rotation", related_name="instances", on_delete=models.CASCADE
)
duration = models.FloatField(default=15.0) # seconds
# generic relation to some kind of InfoItem
item_id = models.PositiveIntegerField()
item_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
item = GenericForeignKey('item_type', 'item_id')
item = GenericForeignKey("item_type", "item_id")
@classmethod
def create_from_dict(cls, d):
@@ -339,31 +338,27 @@ class InfoInstance(models.Model):
except:
raise RuntimeError("invalid parameters supplied supplied")
try:
return cls.objects.create(
rotation=rotation,
item=item,
duration=duration
)
return cls.objects.create(rotation=rotation, item=item, duration=duration)
except:
raise RuntimeError("error while adding instance to db")
def get_dict(self):
"""Convert django model to dict and return it."""
return {
'id': self.id,
'item': self.item.get_dict(),
'duration': self.duration,
"id": self.id,
"item": self.item.get_dict(),
"duration": self.duration,
}
def __str__(self):
"""Return model name."""
return "{}: {} ({}s)".format(
self.rotation.name, self.item.name, self.duration)
return "{}: {} ({}s)".format(self.rotation.name, self.item.name, self.duration)
class Rotation(models.Model):
"""Class for rotation model."""
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=255)
def get_dict(self):
@@ -372,21 +367,20 @@ class Rotation(models.Model):
# to avoid excluding items with no expire_date)
now = timezone.now()
instances = self.instances.all()
filtered = filter(lambda i: (i.item.expire_date or now) >= now,
list(instances))
filtered = filter(lambda i: (i.item.expire_date or now) >= now, list(instances))
instance_list = list(map(lambda i: i.get_dict(), filtered))
return {
'id': self.id,
'name': self.name,
'instances': instance_list,
"id": self.id,
"name": self.name,
"instances": instance_list,
}
def get_list(self):
"""Return list containing infoitem data."""
return {
'id': self.id,
'name': self.name,
"id": self.id,
"name": self.name,
}
def __str__(self):
@@ -397,6 +391,7 @@ class Rotation(models.Model):
class ImageUploadForm(forms.Form):
"""Form used to handle imageuploads to infoscreen app."""
id = models.AutoField(primary_key=True)
name = forms.CharField()
image = forms.ImageField()
@@ -404,5 +399,6 @@ class ImageUploadForm(forms.Form):
class UploadFileForm(forms.Form):
"""Form used for uploading file."""
id = models.AutoField(primary_key=True)
name = forms.CharField()
video = forms.FileField()
-74
View File
@@ -1,74 +0,0 @@
table {
font-size: 4vh;
font-family: 'Droid Sans Mono', monospace;
}
.red {
color: red;
-webkit-animation-name: blinker;
-webkit-animation-duration: 2s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
-moz-animation-name: blinker;
-moz-animation-duration: 2s;
-moz-animation-timing-function: linear;
-moz-animation-iteration-count: infinite;
animation-name: blinker;
animation-duration: 2s;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
.black {
color: black;
}
@-moz-keyframes blinker {
0% { opacity: 1.0; }
50% { opacity: 0.1; }
100% { opacity: 1.0; }
}
@-webkit-keyframes blinker {
0% { opacity: 1.0; }
50% { opacity: 0.1; }
100% { opacity: 1.0; }
}
@keyframes blinker {
0% { opacity: 1.0; }
50% { opacity: 0.1; }
100% { opacity: 1.0; }
}
thead{
background: #f0f0f0;
}
.header-row{
background: #f0f0f0;
font-size: 7vh;
font-family: 'Droid Sans Mono', monospace;
text-align: center;
}
.container {
width: 100vw;
padding: 0 0 0 0;
}
.container .table {
margin-left: 0;
margin-right: 0;
}
.repeat-item.ng-leave {
}
.repeat-item.ng-leave.ng-leave-active {
opacity: 0;
font-size: 0vh;
}
.repeat-item.ng-leave{
opacity: 1;
font-size: 5vh;
}
-4
View File
@@ -1,4 +0,0 @@
<link rel="stylesheet" href="/static/css/coffee.css">
<iframe src="https://host2.kilta.aalto.fi/kahvi/cups" allowfullscreen=true sandbox="allow-scripts allow-pointer-lock allow-same-origin">
<p>Your browser does not support iframes.</p>
</iframe>
-41
View File
@@ -1,41 +0,0 @@
<link rel="stylesheet" href="/static/css/hsl.css">
<link href="https://fonts.googleapis.com/css?family=Droid+Sans+Mono" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.1/locale/fi.js"></script>
<div class="container" ng-app="myApp" ng-controller="timetableCtrl">
<div class="header-row row">
<div class="col-sm-2"><p>{{clock | date:'HH:mm'}}</p></div>
<div class="col-sm-8">HSL-Aikataulut</div>
<div class="col-sm-2 time"></div>
</div>
<h1 style="font-size: 10vh; text-align: center" ng-if="error">
{{error}}
</h1>
<table ng-if="!error" class="table table-striped row">
<thead>
<tr>
<th>
Aika
</th>
<th>
Linja
</th>
<th>
Pys&#228;kki
</th>
</tr>
</thead>
<tbody>
<tr class="repeat-item" ng-repeat="x in stoptimes | orderBy: ['utc'] | limitTo: 11">
<td style="min-width: 300px">
{{x.timestamp}}
</td>
<td>
<strong>{{x.route}}</strong>, {{x.headsign}}
</td>
<td>
{{x.stop}}
</td>
</tr>
</tbody>
</table>
</div>
-10
View File
@@ -1,10 +0,0 @@
<div ng-controller="infoadmin_hslitem_create" style="margin-top:20px;">
<div>
Create new item to show hsl ttimetables. Name is used only as identifier
</div>
<div class="form-group">
<label>Name:</label>
<input type="text" ng-model="item.name"></input>
</div>
<input type="button" class="btn btn-success" ng-click="send()" value="create"></input>
</div>
-20
View File
@@ -1,20 +0,0 @@
<link rel="stylesheet" href="/static/css/sosso.css">
<div ng-controller="SossoController">
<div id="header">
<img id="header-image" src="/static/img/sossoheader.png" >
</div>
<div id="container">
<div class="article-row row" ng-repeat="post in data.posts">
<div class="article-thumb-col col-md-6">
<img class="thumbnail" ng-src="{{ post.thumbnail_images['mh-edition-lite-medium'].url }}">
</div>
<div>
<h1 class="col-md-6">
<div class="article-title-col">
{{ post.title }}
</div>
</h1>
</div>
</div>
</div>
</div>
-1
View File
@@ -1 +0,0 @@
<h1>testi2</h1>
-1
View File
@@ -1 +0,0 @@
<h1>testi3</h1>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 736 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

@@ -2,7 +2,10 @@ body {
font-family: 'Open Sans', sans-serif;
}
#header {
#header:after {
content: " ";
display: block;
clear: both;
}
#header-logo {
@@ -5,6 +5,7 @@ html {
body {
padding: 1.5rem;
margin: 0.5rem;
height: 100%;
}
tbody {
@@ -49,7 +50,18 @@ td {
}
}
#header {
max-width: 100%;
display: flex;
justify-content: flex-end;
}
.tab-content {
margin-top: 1rem;
}
.rotation-title-row {
display: flex;
justify-content: space-between;
align-items: center;
}
@@ -12,7 +12,7 @@ body {
.event {
font-size: 100px;
font-weight: bold;
margin-left: 20px;
margin-left: 20px;
}
.event-col{
padding-top:1vh;
@@ -21,7 +21,7 @@ body {
.header-row{
margin: 30px;
margin-left: 20px;
margin-left: 20px;
font-size: 130px;
padding-bottom:20px;
color:#24a05f;
@@ -1,8 +1,8 @@
#infocontent {
width: 100%;
height: 100%;
position: fixed;
left: 0px;
width: 100%;
height: 100%;
position: fixed;
left: 0px;
top: 0px;
z-index: -1; /* Ensure div tag stays behind content; -999 might work, too. */
}
@@ -0,0 +1,53 @@
#header {
height: 30%;
width: 100%;
background-color:#7c1330;
text-align: center;
}
#header-image {
display: block;
margin-left: auto;
margin-right: auto;
max-width: 100%;
}
.article-row {
min-height: 20vh;
margin: 10px 10px 10px 10px;
}
.article-thumb-col {
max-height: 200px;
text-align: left;
}
.article-title-col {
font-size: 3vw;
}
.thumbnail {
max-width: 355px;
max-height: 200px;
}
#sossoimage {
height: 300px;
position: relative;
left: 0px;
top: 0px;
}
.stretch {
width:100%;
height:100%;
}
#post {
height: 540px;
border:2px solid black;
}
#container {
max-height: 70%;
}
@@ -19,7 +19,7 @@
.article-thumb-col {
max-height: 200px;
text-align: right;
text-align: left;
}
.article-title-col {
@@ -31,10 +31,10 @@
max-height 200px;
}
#sossoimage {
#sossoimage {
height:300px;
position: relative;
left: 0px;
position: relative;
left: 0px;
top: 0px;
}
@@ -1,10 +1,10 @@
<link rel="stylesheet" href="/static/css/abb.css">
<link rel="stylesheet" href="/static/infoscreen/css/abb.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<div ng-controller="ABBController">
<!-- Only show the job listing if there are any jobs, i.e, the jobs list is non-empty -->
<div id="header" class="row" ng-if="jobs.length > 0">
<div id="header-logo">
<img src="/static/img/ABB_logo.png">
<img src="/static/infoscreen/img/ABB_logo.png">
</div>
<div id="header-title">
TYÖPAIKAT
@@ -28,6 +28,6 @@
<!-- If there are no jobs, show a static image -->
<div class="row" ng-if="jobs.length == 0">
<img src="/static/img/ABB_uralle.png" style="position:absolute;left:0;top:0;width:100vw;">
<img src="/static/infoscreen/img/ABB_uralle.png" style="position:absolute;left:0;top:0;width:100vw;">
</div>
</div>
@@ -4,7 +4,7 @@
</div>
<div class="form-group">
<label>Name:</label>
<input type="text" ng-model="item.name"></input>
<input class="form-control" type="text" ng-model="item.name"></input>
</div>
<input type="button" class="btn btn-success" ng-click="send()" value="create"></input>
</div>
@@ -1,4 +1,4 @@
<link rel="stylesheet" href="/static/css/apy.css">
<link rel="stylesheet" href="/static/infoscreen/css/apy.css">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
<div id="bg">
<div class="container " ng-controller="ApyController">
@@ -1,10 +1,10 @@
<div ng-controller="infoadmin_apyitem_create" style="margin-top:20px;">
<div>
create apyitem
Create new ÄPY statistics item
</div>
<div class="form-group">
<label>Name:</label>
<input type="text" ng-model="item.name"></input>
<input class="form-control" type="text" ng-model="item.name"></input>
</div>
<input type="button" class="btn btn-success" ng-click="send()" value="create"></input>
</div>
@@ -1,5 +1,5 @@
<link rel="stylesheet" href="/static/css/events.css">
<link href="https://fonts.googleapis.com/css?family=Droid+Sans+Mono" rel="stylesheet">
<link rel="stylesheet" href="/static/infoscreen/css/events.css">
<link href="https://fonts.googleapis.com/css?family=Droid+Sans+Mono" rel="stylesheet">
<div class="container" ng-app="myApp" ng-controller="EventController">
<div class="header-row row">
<div class="col-sm-6">Tapahtuma</div>
@@ -4,7 +4,7 @@
</div>
<div class="form-group">
<label>Name:</label>
<input type="text" ng-model="item.name"></input>
<input type="text" class="form-control" ng-model="item.name"></input>
</div>
<input type="button" class="btn btn-success" ng-click="send()" value="create"></input>
</div>
@@ -1,4 +1,4 @@
<link rel="stylesheet" href="/static/css/external_website.css">
<link rel="stylesheet" href="/static/infoscreen/css/external_website.css">
<iframe ng-src="{{ url | trusted_url }}" allowfullscreen=true sandbox="allow-scripts allow-pointer-lock allow-same-origin">
<p>Your browser does not support iframes.</p>
</iframe>
@@ -1,14 +1,14 @@
<div ng-controller="infoadmin_websiteitem_create" style="margin-top:20px;">
<div>
Create new item to show external website. For example "ka.dy.fi".
Create new item to show external website. For example "https://ka.dy.fi".
</div>
<div class="form-group">
<label>Name:</label>
<input type="text" ng-model="item.name"></input>
<input type="text" class="form-control" ng-model="item.name"></input>
</div>
<div class="form-group">
<label>Url:</label>
<input type="text" ng-model="item.url"></input>
<input type="text" class="form-control" ng-model="item.url"></input>
</div>
<input type="button" class="btn btn-success" ng-click="send()" value="create"></input>
</div>
@@ -4,11 +4,11 @@
</div>
<div class="form-group">
<label>Name:</label>
<input type="text" ng-model="item.name"></input>
<input type="text" class="form-control" ng-model="item.name"></input>
</div>
<div class="form-group">
<label>Url:</label>
<input type="text" ng-model="item.url"></input>
<input type="text" class="form-control" ng-model="item.url"></input>
</div>
<input type="button" class="btn btn-success" ng-click="send()" value="create"></input>
</div>
@@ -4,7 +4,7 @@
</div>
<div class="form-group">
<label>Name:</label>
<input type="text" ng-model="imagename"></input>
<input type="text" class="form-control" ng-model="imagename"></input>
</div>
<div class="form-group">
<input type="file" ngf-select ng-model="img" name="file" required>
@@ -1,4 +1,4 @@
<link rel="stylesheet" href="/static/css/video.css">
<link rel="stylesheet" href="/static/infoscreen/css/video.css">
<div class="fullscreen-bg">
@@ -4,7 +4,7 @@
</div>
<div class="form-group">
<label>Name:</label>
<input type="text" ng-model="name"></input>
<input type="text" class="form-control" ng-model="name"></input>
</div>
<div class="form-group">
<input type="file" ngf-select ng-model="video" name="file" required>
@@ -0,0 +1,11 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<link rel="stylesheet" href="/static/infoscreen/css/lunch.css">
<div ng-controller="LunchController">
<div id="container">
<div class="restaurant row" ng-repeat="restaurant in data">
<div class="lunch-option" ng-repeat="l in lunch">
<h3 ng-bind-html="l.title | unsafe"></h3>
</div>
</div>
</div>
</div>
@@ -0,0 +1,10 @@
<div ng-controller="infoadmin_lunchitem_create" style="margin-top:20px;">
<div>
Create new item to show restaurants. Name is used only as identifier
</div>
<div class="form-group">
<label>Name:</label>
<input type="text" class="form-control" ng-model="item.name"></input>
</div>
<input type="button" class="btn btn-success" ng-click="send()" value="create"></input>
</div>
@@ -0,0 +1,17 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<link rel="stylesheet" href="/static/infoscreen/css/sosso.css">
<div ng-controller="SossoController">
<div id="header">
<img id="header-image" src="/static/infoscreen/img/sossoheader.png" >
</div>
<div id="container">
<div class="article-row row" ng-repeat="post in data.posts">
<div class="article-thumb-col col-md-4">
<img class="thumbnail" ng-src="{{ post.thumbnail_images['mh-edition-lite-medium'].url }}">
</div>
<div class="col-md-8 article-title-col">
<h1 ng-bind-html="post.title | unsafe"></h1>
</div>
</div>
</div>
</div>
@@ -4,7 +4,7 @@
</div>
<div class="form-group">
<label>Name:</label>
<input type="text" ng-model="item.name"></input>
<input type="text" class="form-control" ng-model="item.name"></input>
</div>
<input type="button" class="btn btn-success" ng-click="send()" value="create"></input>
</div>

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

@@ -182,8 +182,8 @@ var simple_controllers = [
"external_image",
"abbitem",
"sossoitem",
"lunchitem",
"eventitem",
"hslitem",
"websiteitem",
"apyitem",
];
@@ -46,10 +46,18 @@ app.filter('trusted_url', ['$sce', function ($sce) {
};
}]);
//Used for special characters in Sosso. This may open up XSS, so we need to trust that sosso.fi doesn't get compromised...
app.filter('unsafe', function($sce) {
return function(val) {
return $sce.trustAsHtml(val);
};
});
app.controller('ABBController', function($scope, $http){
$scope.jobs = [];
var min_date = moment().subtract(30,'days').format("YYYY-MM-DD%20HH:mm:ss");
var url = "https://sahkoinsinoorikilta.fi/api/news.php";
// TODO: FIX, we try to get rid of php, not depend on it!
var url = "https://old.sahkoinsinoorikilta.fi/api/news.php";
var params = "?type=11&lang=fi&title_search=ABB&min_date="+min_date
$http.get(url+params).then(function(response){
$scope.jobs = _.filter(response.data, function(job){
@@ -75,6 +83,21 @@ app.controller('SossoController', function($scope, $http) {
})
});
app.controller('LunchController', function ($scope, $http) {
$scope.data = [];
var restaurants = [42];
var restaurant_names = ["TUAS"]
var cur_date = new Date().toISOString().split("T")[0]
$http.get("https://kitchen.kanttiinit.fi/menus?restaurants=" + restaurants.join(",") + "&days=" + cur_date).then(function (response) {
$scope.data = restaurant_names.map(function(n, idx) {
return {
name: n,
lunch: response[idx][cur_date],
}
});
})
});
app.controller('ApyController', function($scope, $http) {
$scope.items = [];
$http.get("/infoscreen/apyjson").then(function(response)
@@ -112,35 +135,3 @@ app.filter('unixTimeToDifference', function() {
return res;
}
})
app.controller('timetableCtrl',
function($scope, $http, $interval) {
function load() {
$http.get('/infoscreen/hsl_data')
.then(function(data, status, headers, config) { //eslint-disable-line no-unused-vars
$scope.stoptimes = data.data;
$scope.error = data.data.error || null;
});
$http.get('/infoscreen/hsl_data/settings')
.then(function(data, status, headers, config) { //eslint-disable-line no-unused-vars
$scope.departureThreshold = data.data['departure_threshold'];
$scope.hurryThreshold = data.data['hurry_threshold'];
});
}
function update_clock() {
$scope.clock = Date.now();
}
$scope.$on('$destroy', function() {
$interval.cancel(load_interval);
$interval.cancel(clock_interval);
});
var load_interval = $interval(load, 5000);
var clock_interval = $interval(update_clock, 1000);
update_clock();
load();
}
);
-154
View File
@@ -1,154 +0,0 @@
{% load i18n %}
{% load static %}
{% load staticfiles %}
<!DOCTYPE html>
<html ng-app="infoAdmin">
<head>
<meta charset="utf-8" name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1" />
<title>Infoscreen admin</title>
<script src="{% static "js/lib/angular.js" %}"></script>
<script src="{% static "js/lib/ng-file-upload-bower-12.2.11/ng-file-upload-all.js" %}"></script>
<script src="{% static "js/lib/jquery-3.1.0.min.js" %}"></script>
<script src="{% static "js/lib/bootstrap.min.js" %}"></script>
<script src="{% static "js/lib/underscore-min.js" %}"></script>
<script src="{% static "js/infoadmin_controllers.js" %}"></script>
<link rel="stylesheet" href="{% static "css/lib/bootstrap.min.css" %}"></link>
<link rel="stylesheet" href="{% static "css/base.css" %}"></link>
<link rel="stylesheet" href="{% static "css/infoscreen_admin.css" %}"></link>
</head>
<body>
<div id="header" class="row">
<div class="logout-button">
<form action="/logout" method="post"> {% csrf_token %}
<input type="Submit" value="{% trans "Log out" %}" name="Logout" class="btn btn-danger"/>
</form>
</div>
</div>
<div class="container" ng-controller="infoadmin_ctrl">
<div class="row">
<div class="col-md-12">
<h1>{% trans "Infoscreen Admin Pane" %}</h1>
</div>
</div>
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a data-toggle="tab" href="#slides" role="tab">{% trans "Manage Slides" %}</a></li>
<li class="dropdown">
<a data-toggle="dropdown" href="#">{% trans "Manage Rotations" %}<span class="caret"></span></a>
<ul class="dropdown-menu">
<li ng-repeat="r in rotations"><a href="#rotations" ng-click="selectRotation(r.id)" data-toggle="tab">{$ r.name $}</a></li>
<li class="divider">
<li class="nav-item"><a data-toggle="tab" href="#deleterot" role="tab">{% trans "Create/Delete" %}</a></li>
</ul>
</ul>
<div class="tab-content row">
<div id="slides" class="tab-pane active">
<div ng-controller="infoadmin_ctrl">
<div class="col-xs-12 col-md-6">
<h2>{% trans "Create new item" %}</h2>
<div>{% trans "Create a new item by type" %}</div>
<table class="table table-striped">
<tr>
<td>{% trans "Item type" %}</td>
<td>
<select class="form-control form-control-sm" ng-model="createtype", ng-options="t.name for t in infotypes | orderBy: 'name'">
<option value=""></option>
</select>
</td>
</tr>
</table>
<div ng-include="createtype.create_template_url"></div>
</div>
<div class="col-xs-12 col-md-6">
<h2>{% trans "Info items" %}</h2>
<div>{% trans "Infoitems available for rotations" %}</div>
<table class="table table-striped">
<tr>
<th>{% trans "Item" %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "Delete" %}</th>
</tr>
<tr ng-repeat="i in infoitems | orderBy:['display_name','name']">
<td>{$ i.name $}</td>
<td>{$ i.display_name $}</td>
<td><input type="button" class="btn btn-danger" ng-click="deleteItem(i.item_type, i.id);" value="{% trans "Delete" %}"></input></td>
</tr>
</table>
</div>
</div>
</div>
<div id="rotations" class="tab-pane" ng-controller="infoadmin_ctrl">
<div class="col-xs-12 col-md-6">
<h2>{% trans "Info items" %}</h2>
<div>{% trans "Infoitems available for rotations" %}</div>
<table class="table table-striped">
<tr>
<th>{% trans "Item" %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "Set duration" %}</th>
<th>{% trans "Add to rotation" %}</th>
<th>{% trans "Delete" %}</th>
</tr>
<tr ng-repeat="i in infoitems | orderBy:['display_name','name']">
<td>{$ i.name $}</td>
<td>{$ i.display_name $}</td>
<td><input type="number" min="1" max="60" class="form-control" ng-model="i.duration"></input></td>
<td><input type="button" class="btn btn-success" ng-click="createInstance(selected_rot.id, i.id, i.item_type, i.duration);" value="{% trans "Add" %}"></input></td>
<td><input type="button" class="btn btn-danger" ng-click="deleteItem(i.item_type, i.id);" value="{% trans "Delete" %}"></input></td>
</tr>
</table>
</div>
<div class="col-xs-12 col-md-6">
<h2>{% trans "Rotation" %}: {$ selected_rot.name $}<a href="/infoscreen/{$ selected_rot.id $}"><input type="button" class="btn btn-primary pull-right" value="{% trans "Preview" %}"></a></h2>
<div>{% trans "Instances in currently selected rotation" %}:</div>
<table class="table table-striped">
<tr>
<th>{% trans "Instance" %}</th>
<th>{% trans "Duration" %}</th>
<th>{% trans "Delete" %}</th>
</tr>
<tr ng-repeat="i in selected_rot.instances">
<td>{$ i.item.name $}</td><td>{$ i.duration $} s</td>
<td><input type="button" ng-click="deleteInstance(i.id);" value="{% trans "Delete" %}" class="btn btn-danger"></input></td>
</tr>
</table>
</div>
</div>
<div id="deleterot" class="tab-pane">
<div class="col-xs-12 " ng-controller="infoadmin_ctrl">
<h2>{% trans "Rotations" %}</h2>
<div>
{% trans "Select rotation to edit" %}:
</div>
<table class="table table-striped">
<tr>
<th>{% trans "Rotation" %}</th>
<th>{% trans "id" %}</th>
<th>{% trans "Preview" %}</th>
<th>{% trans "Delete" %}</th>
</tr>
<tr ng-repeat="r in rotations">
<td>{$ r.name $}</td>
<td>{$ r.id $}</td>
<td><a href="/infoscreen/{$ r.id $}"><input type="button" class="btn btn-primary" value="{% trans "Preview" %}"></a></td>
<td><input type="button" class="btn btn-danger" ng-click="deleteRotation(r.id)" value="{% trans "Delete" %}"></input></td>
</tr>
<tr>
<td><input type="text" class="form-control" ng-model="r.name" placeholder="{% trans "Name" %}"></input></td>
<td><input type="button" class="btn btn-success" ng-click="createRotation(r.name)" value="{% trans "Create new" %}"></input></td>
<td></td>
<td></td>
</tr>
</table>
</div>
</div>
</div>
<div style="margin-top: 100px;">
{% include "footer.html" %}
</div>
</div>
</body>
</html>
@@ -1,29 +0,0 @@
{% load static %}
<!DOCTYPE html>
<html ng-app="infoApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Infoscreen</title>
<script src="{% static "js/lib/moment.js" %}"></script>
<script src="{% static "js/lib/angular.js" %}"></script>
<script src="{% static "js/lib/angular-route.js" %}"></script>
<script src="{% static "js/lib/angular-animate.js" %}"></script>
<script src="{% static "js/lib/jquery-3.1.0.min.js" %}"></script>
<script src="{% static "js/lib/bootstrap.min.js" %}"></script>
<script src="{% static "js/lib/underscore-min.js" %}"></script>
<script src="{% static "js/infoscreen_controllers.js" %}"></script>
<link rel="stylesheet" href="{% static "css/lib/bootstrap.min.css" %}"></link>
<link rel="stylesheet" href="{% static "css/infoscreen.css" %}"></link>
</head>
<body>
<div class="container ng-scope" ng-controller="infoscreen_main" ng-init="init({{ rotation }})">
<div ng-animate-swap="index" class="cell swap-animation">
<div id="infocontent" ng-include="active.template" onload="active.onload()"></div>
</div>
</div>
</body>
</html>
+1 -1
View File
@@ -35,6 +35,6 @@ class InfoscreenTestCase(TestCase):
That would mean that something meaningful has been included
in the response.
"""
resp = self.c.get('/infoscreen/items')
resp = self.c.get("/infoscreen/items")
content = resp.json()
self.assertTrue(len(content) > 0)
+29 -28
View File
@@ -1,6 +1,7 @@
"""File containing infoscreen urls."""
from django.conf.urls import url
from django.conf import settings
from infoscreen.views import index
from infoscreen.views import admin
@@ -17,40 +18,40 @@ from infoscreen.views import create_image_item
from infoscreen.views import create_video_item
from infoscreen.views import createABBItem
from infoscreen.views import createSossoItem
from infoscreen.views import createHslItem
from infoscreen.views import createLunchItem
from infoscreen.views import createEventItem
from infoscreen.views import createExternalWebsiteItem
from infoscreen.views import create_rotation
from infoscreen.views import delete_rotation
from infoscreen.views import CurrentHSLView
from infoscreen.views import createApyItem
from infoscreen.views import hsl_timetable_settings
from infoscreen.views import get_apy_json
urlpatterns = [
url(r'^$', default),
url(r'^admin$', admin),
url(r'^(?P<idx>\d+)$', index),
url(r'^items$', info_items),
url(r'^rotation/(?P<idx>\d+)$', rotation),
url(r'^rotations$', rotations),
url(r'^instance$', createInstance),
url(r'^instance/(?P<idx>\d+)$', deleteInstance),
url(r'^types$', info_types),
url(r'^delete_item/(?P<type_id>\d+)/(?P<idx>\d+)$', delete_info_item),
url(r'^create_external_image$', createExternalImageInfoItem),
url(r'^create_image$', create_image_item),
url(r'^create_video$', create_video_item),
url(r'^create_abbitem$', createABBItem),
url(r'^create_sossoitem$', createSossoItem),
url(r'^create_eventitem$', createEventItem),
url(r'^create_hslitem$', createHslItem),
url(r'^create_apyitem$', createApyItem),
url(r'^create_websiteitem$', createExternalWebsiteItem),
url(r'^create_rotation$', create_rotation),
url(r'^delete_rotation/(?P<id>\d+)$', delete_rotation),
url(r'^hsl_data$', CurrentHSLView),
url(r'^hsl_data/settings$', hsl_timetable_settings),
url(r'^apyjson', get_apy_json),
url(r"^$", default),
url(r"^admin$", admin),
url(r"^(?P<idx>\d+)$", index),
url(r"^items$", info_items),
url(r"^rotation/(?P<idx>\d+)$", rotation),
url(r"^rotations$", rotations),
url(r"^instance$", createInstance),
url(r"^instance/(?P<idx>\d+)$", deleteInstance),
url(r"^types$", info_types),
url(r"^delete_item/(?P<type_id>\d+)/(?P<idx>\d+)$", delete_info_item),
url(r"^create_external_image$", createExternalImageInfoItem),
url(r"^create_image$", create_image_item),
url(r"^create_video$", create_video_item),
url(r"^create_abbitem$", createABBItem),
url(r"^create_sossoitem$", createSossoItem),
url(r"^create_lunchitem$", createLunchItem),
url(r"^create_eventitem$", createEventItem),
url(r"^create_apyitem$", createApyItem),
url(r"^create_websiteitem$", createExternalWebsiteItem),
url(r"^create_rotation$", create_rotation),
url(r"^delete_rotation/(?P<id>\d+)$", delete_rotation),
url(r"^apyjson", get_apy_json),
]
if settings.DEBUG:
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()
+58 -46
View File
@@ -6,6 +6,7 @@ from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.http import require_http_methods
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.decorators import permission_required, login_required
from django.db import DatabaseError
from infoscreen.models import UploadFileForm
import sikweb.settings as settings
@@ -14,21 +15,28 @@ import logging
import threading
import requests
from infoscreen.models import Rotation, InfoItem, InfoInstance
from infoscreen.models import (ABBInfoItem, ExternalImageInfoItem,
ImageInfoItem, SossoInfoItem, HslInfoItem)
from infoscreen.models import EventInfoItem
from infoscreen.models import ExternalWebsiteInfoItem
from infoscreen.models import ImageUploadForm
from infoscreen.models import ApyInfoItem
from infoscreen.models import VideoInfoItem
from infoscreen.models import (
Rotation,
InfoItem,
InfoInstance,
ABBInfoItem,
ExternalImageInfoItem,
ImageInfoItem,
SossoInfoItem,
LunchItem,
EventInfoItem,
ExternalWebsiteInfoItem,
ImageUploadForm,
ApyInfoItem,
VideoInfoItem,
)
@login_required(login_url='/login')
@permission_required('infoscreen.change_infoinstance', raise_exception=True)
@login_required(login_url="/admin/login")
@permission_required("infoscreen.change_infoinstance", raise_exception=True)
def admin(request, *args, **kwargs):
"""Render infoscreen admin page."""
return render(request, 'infoscreen_admin.html', {})
return render(request, "infoscreen/infoscreen_admin.html", {})
def create_item_generator(model):
@@ -36,20 +44,23 @@ def create_item_generator(model):
@ensure_csrf_cookie
@require_http_methods(["POST"])
@login_required(login_url='/login')
@permission_required('infoscreen.add_infoinstance', raise_exception=True)
@login_required(login_url="/admin/login")
@permission_required("infoscreen.add_infoinstance", raise_exception=True)
def create_item(request, *args, **kwargs):
try:
data = json.loads(request.body.decode("utf-8"))
except ValueError:
except json.JSONDecodeError:
return HttpResponseBadRequest(
'{"status":"failure","error":"invalid json supplied"}')
'{"status":"failure","error":"invalid json supplied"}'
)
try:
model.create_from_dict(data)
return HttpResponse('{"status":"success"}')
except RuntimeError as e:
return HttpResponseBadRequest(
json.dumps({"status": "failure", "error": str(e)}))
json.dumps({"status": "failure", "error": str(e)})
)
return create_item
@@ -58,8 +69,8 @@ def delete_item_generator(model):
@ensure_csrf_cookie
@require_http_methods(["DELETE"])
@login_required(login_url='/login')
@permission_required('infoscreen.delete_infoinstance', raise_exception=True)
@login_required(login_url="/admin/login")
@permission_required("infoscreen.delete_infoinstance", raise_exception=True)
def delete_item(request, *args, **kwargs):
idx = kwargs.pop("idx", 0)
try:
@@ -71,17 +82,18 @@ def delete_item_generator(model):
try:
item.delete()
return HttpResponse('{"status":"success"}')
except:
except DatabaseError:
resp = HttpResponse('{"error" : "could not delete item"}')
resp.status_code = 500
return resp
return delete_item
# due to model structure this is little complicated
@ensure_csrf_cookie
@login_required(login_url='/login')
@permission_required('infoscreen.delete_infoinstance', raise_exception=True)
@login_required(login_url="/admin/login")
@permission_required("infoscreen.delete_infoinstance", raise_exception=True)
@require_http_methods(["DELETE"])
def delete_info_item(request, *args, **kwargs):
"""Delete info item."""
@@ -97,7 +109,7 @@ def delete_info_item(request, *args, **kwargs):
try:
item.delete()
return HttpResponse('{"status":"success"}')
except:
except DatabaseError:
resp = HttpResponse('{"error" : "could not delete item"}')
resp.status_code = 500
return resp
@@ -105,64 +117,65 @@ def delete_info_item(request, *args, **kwargs):
@require_http_methods(["POST"])
@ensure_csrf_cookie
@login_required(login_url='/login')
@permission_required('infoscreen.add_infoinstance', raise_exception=True)
@login_required(login_url="/admin/login")
@permission_required("infoscreen.add_infoinstance", raise_exception=True)
def create_image_item(request, *args, **kwargs):
"""Create image Infoscreen item."""
form = ImageUploadForm(request.POST, request.FILES)
if not form.is_valid():
return HttpResponseBadRequest('{"status": "failure",'
'"error": "invalid data supplied"}')
return HttpResponseBadRequest(
'{"status": "failure",' '"error": "invalid data supplied"}'
)
img = form.cleaned_data['image']
name = form.cleaned_data['name']
img = form.cleaned_data["image"]
name = form.cleaned_data["name"]
ImageInfoItem.objects.create(img=img, name=name)
return HttpResponse('{"status":"success"}')
@require_http_methods(["POST"])
@ensure_csrf_cookie
@login_required(login_url='/login')
@permission_required('infoscreen.add_infoinstance', raise_exception=True)
@login_required(login_url="/admin/login")
@permission_required("infoscreen.add_infoinstance", raise_exception=True)
def create_video_item(request, *args, **kwargs):
"""Create video Infoscreen item."""
form = UploadFileForm(request.POST, request.FILES)
if not form.is_valid():
return HttpResponseBadRequest('{"status": "failure",'
'"error": "invalid data supplied"}')
return HttpResponseBadRequest(
'{"status": "failure",' '"error": "invalid data supplied"}'
)
video = form.cleaned_data['video']
name = form.cleaned_data['name']
video = form.cleaned_data["video"]
name = form.cleaned_data["name"]
VideoInfoItem.objects.create(video=video, name=name)
return HttpResponse('{"status": "success"}')
@require_http_methods(["POST"])
@ensure_csrf_cookie
@login_required(login_url='/login')
@permission_required('infoscreen.add_rotation', raise_exception=True)
@login_required(login_url="/admin/login")
@permission_required("infoscreen.add_rotation", raise_exception=True)
def create_rotation(request, *args, **kwargs):
"""Create rotation."""
try:
data = json.loads(request.body.decode("utf-8"))
except:
except json.JSONDecodeError:
return HttpResponse('{"error": "bad post body!"}', status=400)
try:
name = data["name"]
Rotation.objects.create(name=name)
resp = HttpResponse(status=200)
except:
resp = HttpResponse(
'{"error" : "could not create rotation!"}', status=400)
except DatabaseError:
resp = HttpResponse('{"error" : "could not create rotation!"}', status=400)
return resp
@require_http_methods(["DELETE"])
@ensure_csrf_cookie
@login_required(login_url='/login')
@permission_required('infoscreen.delete_rotation', raise_exception=True)
@login_required(login_url="/admin/login")
@permission_required("infoscreen.delete_rotation", raise_exception=True)
def delete_rotation(request, *args, **kwargs):
"""Delete rotation."""
id = kwargs.pop("id", 0)
@@ -171,9 +184,8 @@ def delete_rotation(request, *args, **kwargs):
try:
Rotation.objects.filter(id=id).delete()
resp = HttpResponse(status=200)
except:
resp = HttpResponse(
'{"error" : "could not delete rotation!"}', status=400)
except DatabaseError:
resp = HttpResponse('{"error" : "could not delete rotation!"}', status=400)
return resp
@@ -182,7 +194,7 @@ createInstance = create_item_generator(InfoInstance)
deleteInstance = delete_item_generator(InfoInstance)
createABBItem = create_item_generator(ABBInfoItem)
createSossoItem = create_item_generator(SossoInfoItem)
createHslItem = create_item_generator(HslInfoItem)
createLunchItem = create_item_generator(LunchItem)
createExternalImageInfoItem = create_item_generator(ExternalImageInfoItem)
createExternalWebsiteItem = create_item_generator(ExternalWebsiteInfoItem)
createEventItem = create_item_generator(EventInfoItem)
+12 -30
View File
@@ -2,19 +2,20 @@ from django.shortcuts import render
from django.http import HttpResponse, JsonResponse, HttpResponseBadRequest
from django.views.decorators.http import require_http_methods
from django.conf import settings
from django.db import DatabaseError
from infoscreen.models import Rotation, InfoItem, InfoInstance
from infoscreen.hsl_fetcher import fetch as hsl_fetch
import json
import logging
import threading
import requests
@require_http_methods(["GET"])
def index(request, idx, *args, **kwargs):
"""Render infoscreen index page."""
return render(request, 'infoscreen_index.html', {'rotation': idx})
return render(request, "infoscreen/infoscreen_index.html", {"rotation": idx})
@require_http_methods(["GET"])
@@ -22,7 +23,7 @@ def default(request, *args, **kwargs):
"""Try getting first rotation item."""
try:
first = Rotation.objects.all()[0].id
except:
except DatabaseError:
first = 0
return index(request, first, *args, **kwargs)
@@ -31,7 +32,8 @@ def default(request, *args, **kwargs):
def get_apy_json(request):
"""Render APY diilikone page."""
return HttpResponse(
requests.get("https://api-diilikone.apy.fi/deals/top-groups").text)
requests.get("https://api-diilikone.apy.fi/deals/top-groups").text
)
@require_http_methods(["GET"])
@@ -60,10 +62,12 @@ def info_types(request, *args, **kwargs):
types = []
classes = InfoItem.get_subclasses()
for c in classes:
types.append({
"name": c.display_name,
"create_template_url": c.get_create_template_url(),
})
types.append(
{
"name": c.display_name,
"create_template_url": c.get_create_template_url(),
}
)
return HttpResponse(json.dumps(types))
@@ -77,25 +81,3 @@ def info_items(request, *args, **kwargs):
items.append(i.get_dict())
return JsonResponse(items, safe=False)
@require_http_methods(["GET"])
def hsl_timetable_settings(request, *args, **kwargs):
"""Set HSL timetable settings."""
d = {"departure_threshold": settings.HSL_DEPARTURE_THRESHOLD,
"hurry_threshold": settings.HSL_HURRY_THRESHOLD}
return JsonResponse(d, status=200)
@require_http_methods(["GET"])
def CurrentHSLView(request, *args, **kwargs):
"""Get HSL data and return it."""
try:
api_resp = hsl_fetch()
except Exception as ex:
logging.exception('Failed to fetch HSL timetables.')
error = {'error': 'Aikataulujen haku epäonnistui.'}
return JsonResponse(error, status=200)
return JsonResponse(api_resp, status=200, safe=False)

Some files were not shown because too many files have changed in this diff Show More