Rewrite TG integration, support for other webhooks
This commit is contained in:
+1
-2
@@ -1,10 +1,9 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from modeltranslation.admin import TranslationAdmin
|
from modeltranslation.admin import TranslationAdmin
|
||||||
|
|
||||||
from kaehmy.models import Application, Comment, CustomRole, PresetRole, TelegramChannel
|
from kaehmy.models import Application, Comment, CustomRole, PresetRole
|
||||||
|
|
||||||
admin.site.register(Application)
|
admin.site.register(Application)
|
||||||
admin.site.register(Comment)
|
admin.site.register(Comment)
|
||||||
admin.site.register(CustomRole)
|
admin.site.register(CustomRole)
|
||||||
admin.site.register(PresetRole, TranslationAdmin)
|
admin.site.register(PresetRole, TranslationAdmin)
|
||||||
admin.site.register(TelegramChannel)
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# Generated by Django 2.2.26 on 2022-01-12 20:38
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('kaehmy', '0005_auto_20190312_1458'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='TelegramChannel',
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -148,18 +148,3 @@ class Application(CommentParent):
|
|||||||
|
|
||||||
def has_any_board_role(self):
|
def has_any_board_role(self):
|
||||||
return self.preset_roles.filter(is_board=True).exists() or self.custom_roles.filter(is_board=True)
|
return self.preset_roles.filter(is_board=True).exists() or self.custom_roles.filter(is_board=True)
|
||||||
|
|
||||||
|
|
||||||
# Telegram channel entry for Kaehmys
|
|
||||||
class TelegramChannel(models.Model):
|
|
||||||
"""Model containing the channel id of a Telegram chat"""
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
verbose_name = _('Telegram channel')
|
|
||||||
verbose_name_plural = _('Telegram channels')
|
|
||||||
|
|
||||||
name = models.CharField(max_length=255)
|
|
||||||
channel_id = models.CharField(max_length=255, unique=True)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return 'Telegram channel: "{}"'.format(self.name)
|
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
'''
|
|
||||||
A telegram bot api for whatever purposes.
|
|
||||||
TODO: kaehmy app is definitely not correct place for this
|
|
||||||
'''
|
|
||||||
import logging
|
|
||||||
import requests
|
|
||||||
from django.conf import settings
|
|
||||||
from kaehmy.models import TelegramChannel
|
|
||||||
|
|
||||||
|
|
||||||
class TelegramBot:
|
|
||||||
'''
|
|
||||||
A telegram bot api for whatever purposes
|
|
||||||
Currently only able to broadcast stuff to all registered
|
|
||||||
channels using broadcast method.
|
|
||||||
'''
|
|
||||||
|
|
||||||
def __init__(self, api_token=None):
|
|
||||||
|
|
||||||
self.api_token = api_token or settings.TELEGRAM_BOT_TOKEN
|
|
||||||
self.send_message_url = "https://api.telegram.org/bot{}/sendMessage".format(self.api_token)
|
|
||||||
|
|
||||||
def broadcast(self, message):
|
|
||||||
channels_ids = TelegramChannel.objects.values_list("channel_id", flat=True)
|
|
||||||
for id_ in channels_ids:
|
|
||||||
self.send_message(id_, message)
|
|
||||||
|
|
||||||
def send_message(self, channel_id, message):
|
|
||||||
'''
|
|
||||||
Send message to a chat with given channel_id
|
|
||||||
'''
|
|
||||||
data = {
|
|
||||||
'chat_id': channel_id,
|
|
||||||
'text': message,
|
|
||||||
'parse_mode': 'Markdown'
|
|
||||||
}
|
|
||||||
resp = requests.post(self.send_message_url, json=data)
|
|
||||||
logging.debug(resp.content)
|
|
||||||
+3
-12
@@ -13,10 +13,11 @@ from dealer.git import git
|
|||||||
from sikweb.settings import URL
|
from sikweb.settings import URL
|
||||||
|
|
||||||
from members.views.utils import *
|
from members.views.utils import *
|
||||||
from kaehmy.models import Application, CustomRole, PresetRole, TelegramChannel
|
from kaehmy.models import Application, CustomRole, PresetRole
|
||||||
from kaehmy.forms import ApplicationForm, CommentForm
|
from kaehmy.forms import ApplicationForm, CommentForm
|
||||||
from kaehmy.tables import ExportTable
|
from kaehmy.tables import ExportTable
|
||||||
from webapp.utils import send_email
|
from webapp.utils import send_email
|
||||||
|
from webapp.webhook import processHooks
|
||||||
|
|
||||||
|
|
||||||
@ensure_csrf_cookie
|
@ensure_csrf_cookie
|
||||||
@@ -135,17 +136,7 @@ def submit(request, *args, **kwargs):
|
|||||||
send_email(email, subject, body)
|
send_email(email, subject, body)
|
||||||
logging.debug('Sent kaehmy email to recipient <{}>'.format(email))
|
logging.debug('Sent kaehmy email to recipient <{}>'.format(email))
|
||||||
|
|
||||||
CHAT_IDS = [channel.channel_id for channel in TelegramChannel.objects.all()]
|
processHooks(message=f'Uusi New kaehmy! {name} -> {url}', eventType="kaehmy")
|
||||||
for chat_id in CHAT_IDS:
|
|
||||||
tg_string = 'https://api.telegram.org/bot{}/sendMessage?chat_id={}&text={}'.format(
|
|
||||||
settings.TELEGRAM_BOT_TOKEN,
|
|
||||||
chat_id,
|
|
||||||
'Uusi New kaehmy! {} -> {}'.format(name, url)
|
|
||||||
)
|
|
||||||
response = requests.get(tg_string).json()
|
|
||||||
logging.debug('Telegram API response:\n{}'.format(response))
|
|
||||||
logging.debug('Sent kaehmy announcement to {} channels.'.format(len(CHAT_IDS)))
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
context = {
|
context = {
|
||||||
'error': form.errors
|
'error': form.errors
|
||||||
|
|||||||
+140
-90
@@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2021-01-18 21:36+0200\n"
|
"POT-Creation-Date: 2022-01-12 23:55+0200\n"
|
||||||
"PO-Revision-Date: 2017-11-02 23:09+0200\n"
|
"PO-Revision-Date: 2017-11-02 23:09+0200\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
@@ -37,7 +37,7 @@ msgstr "Sössö articles"
|
|||||||
msgid "Today's lunch"
|
msgid "Today's lunch"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: infoscreen/models.py:212 webapp/models.py:70
|
#: infoscreen/models.py:212 webapp/models.py:73
|
||||||
msgid "Events"
|
msgid "Events"
|
||||||
msgstr "Events"
|
msgstr "Events"
|
||||||
|
|
||||||
@@ -112,8 +112,8 @@ msgstr "Preview"
|
|||||||
msgid "Delete"
|
msgid "Delete"
|
||||||
msgstr "Delete"
|
msgstr "Delete"
|
||||||
|
|
||||||
#: infoscreen/templates/tabs/add_remove.html:23 kaehmy/models.py:62
|
#: infoscreen/templates/tabs/add_remove.html:23 kaehmy/models.py:57
|
||||||
#: kaehmy/templates/list.html:36 webapp/models.py:144 webapp/models.py:173
|
#: kaehmy/templates/list.html:36 webapp/models.py:147 webapp/models.py:176
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr "Name"
|
msgstr "Name"
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ msgstr "Phone number (not public)"
|
|||||||
msgid "Custom roles"
|
msgid "Custom roles"
|
||||||
msgstr "Custom roles"
|
msgstr "Custom roles"
|
||||||
|
|
||||||
#: kaehmy/forms.py:49 kaehmy/templates/kaehmy.html:43
|
#: kaehmy/forms.py:49 kaehmy/templates/kaehmy.html:42
|
||||||
msgid "Preset roles"
|
msgid "Preset roles"
|
||||||
msgstr "Preset roles"
|
msgstr "Preset roles"
|
||||||
|
|
||||||
@@ -201,156 +201,148 @@ msgstr "Invalid phone number"
|
|||||||
msgid "Custom role with the same name already exists."
|
msgid "Custom role with the same name already exists."
|
||||||
msgstr "Custom role with the same name already exists."
|
msgstr "Custom role with the same name already exists."
|
||||||
|
|
||||||
#: kaehmy/models.py:18
|
#: kaehmy/models.py:13
|
||||||
msgid "Kaehmy"
|
msgid "Kaehmy"
|
||||||
msgstr "Kaehmy"
|
msgstr "Kaehmy"
|
||||||
|
|
||||||
#: kaehmy/models.py:25
|
#: kaehmy/models.py:20
|
||||||
msgid "Corporate affairs"
|
msgid "Corporate affairs"
|
||||||
msgstr "Corporate affairs"
|
msgstr "Corporate affairs"
|
||||||
|
|
||||||
#: kaehmy/models.py:26 webapp/templates/freshmen.html:10
|
#: kaehmy/models.py:21 webapp/templates/freshmen.html:10
|
||||||
#: webapp/templates/navigation.html:8
|
#: webapp/templates/navigation.html:8
|
||||||
msgid "Freshmen"
|
msgid "Freshmen"
|
||||||
msgstr "Freshmen"
|
msgstr "Freshmen"
|
||||||
|
|
||||||
#: kaehmy/models.py:27 webapp/templates/international.html:10
|
#: kaehmy/models.py:22 webapp/templates/international.html:10
|
||||||
#: webapp/templates/navigation.html:14
|
#: webapp/templates/navigation.html:14
|
||||||
msgid "International"
|
msgid "International"
|
||||||
msgstr "International"
|
msgstr "International"
|
||||||
|
|
||||||
#: kaehmy/models.py:28
|
#: kaehmy/models.py:23
|
||||||
msgid "External affairs"
|
msgid "External affairs"
|
||||||
msgstr "External affairs"
|
msgstr "External affairs"
|
||||||
|
|
||||||
#: kaehmy/models.py:29
|
#: kaehmy/models.py:24
|
||||||
msgid "Media"
|
msgid "Media"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:30
|
#: kaehmy/models.py:25
|
||||||
msgid "Technology"
|
msgid "Technology"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:31
|
#: kaehmy/models.py:26
|
||||||
msgid "Wellbeing"
|
msgid "Wellbeing"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:32
|
#: kaehmy/models.py:27
|
||||||
msgid "Elepaja"
|
msgid "Elepaja"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:33
|
#: kaehmy/models.py:28
|
||||||
msgid "Ceremonies"
|
msgid "Ceremonies"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:34
|
#: kaehmy/models.py:29
|
||||||
msgid "Studies"
|
msgid "Studies"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:35
|
#: kaehmy/models.py:30
|
||||||
msgid "Sössö magazine"
|
msgid "Sössö magazine"
|
||||||
msgstr "Sössö magazine"
|
msgstr "Sössö magazine"
|
||||||
|
|
||||||
#: kaehmy/models.py:36
|
#: kaehmy/models.py:31
|
||||||
msgid "Alumni relations"
|
msgid "Alumni relations"
|
||||||
msgstr "Alumni relations"
|
msgstr "Alumni relations"
|
||||||
|
|
||||||
#: kaehmy/models.py:37
|
#: kaehmy/models.py:32
|
||||||
msgid "Others"
|
msgid "Others"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:39
|
#: kaehmy/models.py:34
|
||||||
msgid "Category"
|
msgid "Category"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:45
|
#: kaehmy/models.py:40
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr "Description"
|
msgstr "Description"
|
||||||
|
|
||||||
#: kaehmy/models.py:48
|
#: kaehmy/models.py:43
|
||||||
msgid "Preset kaehmy role"
|
msgid "Preset kaehmy role"
|
||||||
msgstr "Preset kaehmy role"
|
msgstr "Preset kaehmy role"
|
||||||
|
|
||||||
#: kaehmy/models.py:49
|
#: kaehmy/models.py:44
|
||||||
msgid "Preset kaehmy roles"
|
msgid "Preset kaehmy roles"
|
||||||
msgstr "Preset kaehmy roles"
|
msgstr "Preset kaehmy roles"
|
||||||
|
|
||||||
#: kaehmy/models.py:56
|
#: kaehmy/models.py:51
|
||||||
msgid "Custom kaehmy role"
|
msgid "Custom kaehmy role"
|
||||||
msgstr "Custom kaehmy role"
|
msgstr "Custom kaehmy role"
|
||||||
|
|
||||||
#: kaehmy/models.py:57
|
#: kaehmy/models.py:52
|
||||||
msgid "Custom kaehmy roles"
|
msgid "Custom kaehmy roles"
|
||||||
msgstr "Custom kaehmy roles"
|
msgstr "Custom kaehmy roles"
|
||||||
|
|
||||||
#: kaehmy/models.py:63 kaehmy/templates/list.html:40 members/models.py:14
|
#: kaehmy/models.py:58 kaehmy/templates/list.html:40 members/models.py:14
|
||||||
msgid "Email"
|
msgid "Email"
|
||||||
msgstr "Email"
|
msgstr "Email"
|
||||||
|
|
||||||
#: kaehmy/models.py:64
|
#: kaehmy/models.py:59
|
||||||
msgid "Timestamp"
|
msgid "Timestamp"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:78
|
#: kaehmy/models.py:73
|
||||||
msgid "Kaehmykommentti"
|
msgid "Kaehmykommentti"
|
||||||
msgstr "Kaehmy comment"
|
msgstr "Kaehmy comment"
|
||||||
|
|
||||||
#: kaehmy/models.py:79
|
#: kaehmy/models.py:74
|
||||||
msgid "Kaehmykommentit"
|
msgid "Kaehmykommentit"
|
||||||
msgstr "Kaehmy comments"
|
msgstr "Kaehmy comments"
|
||||||
|
|
||||||
#: kaehmy/models.py:81 ohlhafv/models.py:36
|
#: kaehmy/models.py:76 ohlhafv/models.py:36
|
||||||
msgid "Message"
|
msgid "Message"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:100 kaehmy/templates/kaehmy.html:12
|
#: kaehmy/models.py:95 kaehmy/templates/kaehmy.html:12
|
||||||
msgid "Kaehmylomake"
|
msgid "Kaehmylomake"
|
||||||
msgstr "Kaehmy application"
|
msgstr "Kaehmy application"
|
||||||
|
|
||||||
#: kaehmy/models.py:101
|
#: kaehmy/models.py:96
|
||||||
msgid "Kaehmylomakkeet"
|
msgid "Kaehmylomakkeet"
|
||||||
msgstr "Kaehmy applications"
|
msgstr "Kaehmy applications"
|
||||||
|
|
||||||
#: kaehmy/models.py:104
|
#: kaehmy/models.py:99
|
||||||
msgid "Phone number"
|
msgid "Phone number"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:105
|
#: kaehmy/models.py:100
|
||||||
msgid "Year"
|
msgid "Year"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:106
|
#: kaehmy/models.py:101
|
||||||
msgid "Text"
|
msgid "Text"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:108
|
#: kaehmy/models.py:103
|
||||||
msgid "Custom role name"
|
msgid "Custom role name"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:110 webapp/models.py:174
|
#: kaehmy/models.py:105 webapp/models.py:177
|
||||||
msgid "Board member"
|
msgid "Board member"
|
||||||
msgstr "Board member"
|
msgstr "Board member"
|
||||||
|
|
||||||
#: kaehmy/models.py:118
|
#: kaehmy/models.py:113
|
||||||
msgid "Kaehmy application: {}"
|
msgid "Kaehmy application: {}"
|
||||||
msgstr "Kaehmy application: {}"
|
msgstr "Kaehmy application: {}"
|
||||||
|
|
||||||
#: kaehmy/models.py:140
|
#: kaehmy/models.py:135
|
||||||
msgid "Board: {}"
|
msgid "Board: {}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:146
|
#: kaehmy/models.py:141
|
||||||
msgid "Official: {}"
|
msgid "Official: {}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/models.py:163
|
|
||||||
msgid "Telegram channel"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: kaehmy/models.py:164
|
|
||||||
msgid "Telegram channels"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: kaehmy/tables.py:13
|
#: kaehmy/tables.py:13
|
||||||
msgid "Roles"
|
msgid "Roles"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -427,31 +419,36 @@ msgid "Päivämääriä & deadlineja"
|
|||||||
msgstr "Dates and deadlines"
|
msgstr "Dates and deadlines"
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:31
|
#: kaehmy/templates/kaehmy.html:31
|
||||||
msgid "Hallitustyrkkypaneeli"
|
#, fuzzy
|
||||||
msgstr "Panel for board applicants"
|
#| msgid "Vaalikokous, osa 1 (puheenjohtajan valinta)"
|
||||||
|
msgid "Vaalikokous, osa 1 (puheenjohtajan valinta) ja hallitustyrkkypaneeli"
|
||||||
|
msgstr "Election meeting, part 1 (chairman election)"
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:32
|
#: kaehmy/templates/kaehmy.html:32
|
||||||
msgid "Vaalikokous, osa 1 (puheenjohtajan valinta)"
|
msgid "Vaalikokous, osa 2 (hallituksen valinta)"
|
||||||
msgstr "Election meeting, part 1 (chairman election)"
|
msgstr "Election meeting, part 2 (board election)"
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:33
|
#: kaehmy/templates/kaehmy.html:33
|
||||||
msgid "Toimikunta-appro"
|
msgid "Toimikunta-appro"
|
||||||
msgstr "Guild committee crawl"
|
msgstr "Guild committee crawl"
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:34
|
#: kaehmy/templates/kaehmy.html:34
|
||||||
msgid "Vaalikokous, osa 2 (hallituksen valinta)"
|
|
||||||
msgstr "Election meeting, part 2 (board election)"
|
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:35
|
|
||||||
msgid "Vaalikokous, osa 3 (toimarien valinta)"
|
msgid "Vaalikokous, osa 3 (toimarien valinta)"
|
||||||
msgstr "Election meeting, part 3 (non-board election)"
|
msgstr "Election meeting, part 3 (non-board election)"
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:78
|
#: kaehmy/templates/kaehmy.html:77
|
||||||
#, python-format
|
#, fuzzy, python-format
|
||||||
|
#| msgid ""
|
||||||
|
#| "\n"
|
||||||
|
#| " Hyväksyn <a href=\"https://sik.ayy.fi/files/official/"
|
||||||
|
#| "Tietosuojaseloste%%20%%E2%%80%%93%%20Toimihenkil%%C3%%B6ksi%%20hakemisen"
|
||||||
|
#| "%%20rekisteri.pdf\" target=\"_blank\">tietosuojaselosteen</a> ja "
|
||||||
|
#| "tietojeni tallentamisen.\n"
|
||||||
|
#| " "
|
||||||
msgid ""
|
msgid ""
|
||||||
"\n"
|
"\n"
|
||||||
" Hyväksyn <a href=\"https://sik.ayy.fi/files/official/"
|
" Hyväksyn <a href=\"https://static.sahkoinsinoorikilta.fi/"
|
||||||
"Tietosuojaseloste%%20%%E2%%80%%93%%20Toimihenkil%%C3%%B6ksi%%20hakemisen"
|
"GDPR/Tietosuojaseloste%%20%%23U2013%%20Toimihenkil%%23U00f6ksi%%20hakemisen"
|
||||||
"%%20rekisteri.pdf\" target=\"_blank\">tietosuojaselosteen</a> ja tietojeni "
|
"%%20rekisteri.pdf\" target=\"_blank\">tietosuojaselosteen</a> ja tietojeni "
|
||||||
"tallentamisen.\n"
|
"tallentamisen.\n"
|
||||||
" "
|
" "
|
||||||
@@ -463,7 +460,7 @@ msgstr ""
|
|||||||
"of personal data.\n"
|
"of personal data.\n"
|
||||||
" "
|
" "
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:84 members/templates/settings.html:23
|
#: kaehmy/templates/kaehmy.html:83 members/templates/settings.html:23
|
||||||
msgid "Submit"
|
msgid "Submit"
|
||||||
msgstr "Submit"
|
msgstr "Submit"
|
||||||
|
|
||||||
@@ -639,12 +636,16 @@ msgid "Hienoa! Jäsenhakemuksesi on nyt lähetetty."
|
|||||||
msgstr "Amazing! Your membership application has been sent."
|
msgstr "Amazing! Your membership application has been sent."
|
||||||
|
|
||||||
#: members/templates/application_success.html:9
|
#: members/templates/application_success.html:9
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid ""
|
||||||
|
#| "Vahvistusviesti on lähetetty sähköpostiisi. Ota yhteyttä "
|
||||||
|
#| "admin@sahkoinsinoorikilta.fi.fi jos viestiä ei näy."
|
||||||
msgid ""
|
msgid ""
|
||||||
"Vahvistusviesti on lähetetty sähköpostiisi. Ota yhteyttä admin@sahkoinsinoorikilta.fi."
|
"Vahvistusviesti on lähetetty sähköpostiisi. Ota yhteyttä "
|
||||||
"fi jos viestiä ei näy."
|
"admin@sahkoinsinoorikilta.fi jos viestiä ei näy."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Confirmation email is sent to given email address. Contact admin@sahkoinsinoorikilta.fi."
|
"Confirmation email is sent to given email address. Contact "
|
||||||
"fi if you didn't receive it."
|
"admin@sahkoinsinoorikilta.fi.fi if you didn't receive it."
|
||||||
|
|
||||||
#: members/templates/application_success.html:10
|
#: members/templates/application_success.html:10
|
||||||
msgid "Takaisin Sähköinsinöörikillan web-sivuille"
|
msgid "Takaisin Sähköinsinöörikillan web-sivuille"
|
||||||
@@ -914,11 +915,11 @@ msgstr "Payments in register:"
|
|||||||
msgid "Language"
|
msgid "Language"
|
||||||
msgstr "Language"
|
msgstr "Language"
|
||||||
|
|
||||||
#: members/templates/settings.html:20 sikweb/base.py:217
|
#: members/templates/settings.html:20 sikweb/base.py:216
|
||||||
msgid "Finnish"
|
msgid "Finnish"
|
||||||
msgstr "Finnish"
|
msgstr "Finnish"
|
||||||
|
|
||||||
#: members/templates/settings.html:21 sikweb/base.py:218
|
#: members/templates/settings.html:21 sikweb/base.py:217
|
||||||
msgid "English"
|
msgid "English"
|
||||||
msgstr "English"
|
msgstr "English"
|
||||||
|
|
||||||
@@ -1100,7 +1101,9 @@ msgid "Challenge"
|
|||||||
msgstr "Challenge"
|
msgstr "Challenge"
|
||||||
|
|
||||||
#: ohlhafv/views.py:44
|
#: ohlhafv/views.py:44
|
||||||
msgid "Sinut on haastettu Øhlhäfviin!"
|
#, fuzzy
|
||||||
|
#| msgid "Sinut on haastettu Øhlhäfviin!"
|
||||||
|
msgid "Sinut on haastettu Ohlhäfviin!"
|
||||||
msgstr "You have been challenged at Ohlhafv!"
|
msgstr "You have been challenged at Ohlhafv!"
|
||||||
|
|
||||||
#: templates/admin/base_site.html:44
|
#: templates/admin/base_site.html:44
|
||||||
@@ -1112,91 +1115,135 @@ msgstr "Go"
|
|||||||
msgid "Aalto-yliopiston Sähköinsinöörikilta ry"
|
msgid "Aalto-yliopiston Sähköinsinöörikilta ry"
|
||||||
msgstr "Aalto-yliopiston Sähköinsinöörikilta ry"
|
msgstr "Aalto-yliopiston Sähköinsinöörikilta ry"
|
||||||
|
|
||||||
#: webapp/models.py:18
|
#: webapp/models.py:21
|
||||||
msgid "Webapp"
|
msgid "Webapp"
|
||||||
msgstr "Webapp"
|
msgstr "Webapp"
|
||||||
|
|
||||||
#: webapp/models.py:26
|
#: webapp/models.py:29
|
||||||
msgid "Tag"
|
msgid "Tag"
|
||||||
msgstr "Tag"
|
msgstr "Tag"
|
||||||
|
|
||||||
#: webapp/models.py:27
|
#: webapp/models.py:30
|
||||||
msgid "Tags"
|
msgid "Tags"
|
||||||
msgstr "Tags"
|
msgstr "Tags"
|
||||||
|
|
||||||
#: webapp/models.py:34
|
#: webapp/models.py:37
|
||||||
msgid "Tag: {}"
|
msgid "Tag: {}"
|
||||||
msgstr "Tag: {}"
|
msgstr "Tag: {}"
|
||||||
|
|
||||||
#: webapp/models.py:52
|
#: webapp/models.py:55
|
||||||
msgid "Feed"
|
msgid "Feed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:53
|
#: webapp/models.py:56
|
||||||
msgid "Feeds"
|
msgid "Feeds"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:61 webapp/models.py:80 webapp/models.py:119
|
#: webapp/models.py:64 webapp/models.py:83 webapp/models.py:122
|
||||||
#: webapp/models.py:152 webapp/models.py:198
|
#: webapp/models.py:155 webapp/models.py:201
|
||||||
msgid "Deleted: "
|
msgid "Deleted: "
|
||||||
msgstr "Deleted: "
|
msgstr "Deleted: "
|
||||||
|
|
||||||
#: webapp/models.py:62
|
#: webapp/models.py:65
|
||||||
msgid "{}Feed: {}"
|
msgid "{}Feed: {}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:69
|
#: webapp/models.py:72
|
||||||
msgid "Event"
|
msgid "Event"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:81
|
#: webapp/models.py:84
|
||||||
msgid "{}Event: {}"
|
msgid "{}Event: {}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:91
|
#: webapp/models.py:93
|
||||||
msgid "Template question"
|
msgid "Template question"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:92
|
#: webapp/models.py:94
|
||||||
msgid "Template questions"
|
msgid "Template questions"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:98
|
#: webapp/models.py:101
|
||||||
msgid "Template questions: {}"
|
msgid "Template questions: {}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:105
|
#: webapp/models.py:108
|
||||||
msgid "Signup form"
|
msgid "Signup form"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:106
|
#: webapp/models.py:109
|
||||||
msgid "Signup forms"
|
msgid "Signup forms"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:120
|
#: webapp/models.py:123
|
||||||
msgid "#{} {}{}"
|
msgid "#{} {}{}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:138
|
#: webapp/models.py:141
|
||||||
msgid "Sign-up"
|
msgid "Sign-up"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:139
|
#: webapp/models.py:142
|
||||||
msgid "Sign-ups"
|
msgid "Sign-ups"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:178
|
#: webapp/models.py:181
|
||||||
msgid "board member"
|
msgid "board member"
|
||||||
msgstr "board member"
|
msgstr "board member"
|
||||||
|
|
||||||
#: webapp/models.py:185
|
#: webapp/models.py:188
|
||||||
msgid "JobAd"
|
msgid "JobAd"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:186
|
#: webapp/models.py:189
|
||||||
msgid "JobAds"
|
msgid "JobAds"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: webapp/models.py:211
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "Kaehmy"
|
||||||
|
msgid "Hook Kaehmys"
|
||||||
|
msgstr "Kaehmy"
|
||||||
|
|
||||||
|
#: webapp/models.py:212
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "Total challenges:"
|
||||||
|
msgid "Hook Ohlhafv challenges"
|
||||||
|
msgstr "Total challenges:"
|
||||||
|
|
||||||
|
#: webapp/models.py:213
|
||||||
|
msgid "Hook published news"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: webapp/models.py:214
|
||||||
|
msgid "Hook published Job Ads"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: webapp/models.py:215
|
||||||
|
msgid "Hook published events"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: webapp/models.py:216
|
||||||
|
msgid "Hook opened signups"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: webapp/models.py:241
|
||||||
|
msgid "Webhook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: webapp/models.py:242
|
||||||
|
msgid "Webhooks"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: webapp/models.py:256
|
||||||
|
msgid "Telegram channel"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: webapp/models.py:257
|
||||||
|
msgid "Telegram channels"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/templates/contact.html:9 webapp/templates/navigation.html:20
|
#: webapp/templates/contact.html:9 webapp/templates/navigation.html:20
|
||||||
msgid "Contact"
|
msgid "Contact"
|
||||||
msgstr "Contact"
|
msgstr "Contact"
|
||||||
@@ -1240,3 +1287,6 @@ msgstr "Sössö"
|
|||||||
#: webapp/templates/navigation.html:24
|
#: webapp/templates/navigation.html:24
|
||||||
msgid "Corporate"
|
msgid "Corporate"
|
||||||
msgstr "Corporate"
|
msgstr "Corporate"
|
||||||
|
|
||||||
|
#~ msgid "Hallitustyrkkypaneeli"
|
||||||
|
#~ msgstr "Panel for board applicants"
|
||||||
|
|||||||
+120
-92
@@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2021-01-18 21:36+0200\n"
|
"POT-Creation-Date: 2022-01-12 23:55+0200\n"
|
||||||
"PO-Revision-Date: 2017-11-02 23:04+0200\n"
|
"PO-Revision-Date: 2017-11-02 23:04+0200\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
@@ -38,7 +38,7 @@ msgstr "Sössön artikkelit"
|
|||||||
msgid "Today's lunch"
|
msgid "Today's lunch"
|
||||||
msgstr "Päivän lounas"
|
msgstr "Päivän lounas"
|
||||||
|
|
||||||
#: infoscreen/models.py:212 webapp/models.py:70
|
#: infoscreen/models.py:212 webapp/models.py:73
|
||||||
msgid "Events"
|
msgid "Events"
|
||||||
msgstr "Tapahtumat"
|
msgstr "Tapahtumat"
|
||||||
|
|
||||||
@@ -113,8 +113,8 @@ msgstr "Esikatsele"
|
|||||||
msgid "Delete"
|
msgid "Delete"
|
||||||
msgstr "Poista"
|
msgstr "Poista"
|
||||||
|
|
||||||
#: infoscreen/templates/tabs/add_remove.html:23 kaehmy/models.py:62
|
#: infoscreen/templates/tabs/add_remove.html:23 kaehmy/models.py:57
|
||||||
#: kaehmy/templates/list.html:36 webapp/models.py:144 webapp/models.py:173
|
#: kaehmy/templates/list.html:36 webapp/models.py:147 webapp/models.py:176
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr "Nimi"
|
msgstr "Nimi"
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ msgstr "Puhelinnumero (ei julkinen)"
|
|||||||
msgid "Custom roles"
|
msgid "Custom roles"
|
||||||
msgstr "Uudet virat"
|
msgstr "Uudet virat"
|
||||||
|
|
||||||
#: kaehmy/forms.py:49 kaehmy/templates/kaehmy.html:43
|
#: kaehmy/forms.py:49 kaehmy/templates/kaehmy.html:42
|
||||||
msgid "Preset roles"
|
msgid "Preset roles"
|
||||||
msgstr "Kaehmyvirat"
|
msgstr "Kaehmyvirat"
|
||||||
|
|
||||||
@@ -202,156 +202,148 @@ msgstr "Virheellinen puhelinnumero"
|
|||||||
msgid "Custom role with the same name already exists."
|
msgid "Custom role with the same name already exists."
|
||||||
msgstr "Samanniminen virka on jo olemassa."
|
msgstr "Samanniminen virka on jo olemassa."
|
||||||
|
|
||||||
#: kaehmy/models.py:18
|
#: kaehmy/models.py:13
|
||||||
msgid "Kaehmy"
|
msgid "Kaehmy"
|
||||||
msgstr "Kaehmy"
|
msgstr "Kaehmy"
|
||||||
|
|
||||||
#: kaehmy/models.py:25
|
#: kaehmy/models.py:20
|
||||||
msgid "Corporate affairs"
|
msgid "Corporate affairs"
|
||||||
msgstr "Yrityssuhteet"
|
msgstr "Yrityssuhteet"
|
||||||
|
|
||||||
#: kaehmy/models.py:26 webapp/templates/freshmen.html:10
|
#: kaehmy/models.py:21 webapp/templates/freshmen.html:10
|
||||||
#: webapp/templates/navigation.html:8
|
#: webapp/templates/navigation.html:8
|
||||||
msgid "Freshmen"
|
msgid "Freshmen"
|
||||||
msgstr "Fuksit"
|
msgstr "Fuksit"
|
||||||
|
|
||||||
#: kaehmy/models.py:27 webapp/templates/international.html:10
|
#: kaehmy/models.py:22 webapp/templates/international.html:10
|
||||||
#: webapp/templates/navigation.html:14
|
#: webapp/templates/navigation.html:14
|
||||||
msgid "International"
|
msgid "International"
|
||||||
msgstr "International"
|
msgstr "International"
|
||||||
|
|
||||||
#: kaehmy/models.py:28
|
#: kaehmy/models.py:23
|
||||||
msgid "External affairs"
|
msgid "External affairs"
|
||||||
msgstr "Ulkosuhteet"
|
msgstr "Ulkosuhteet"
|
||||||
|
|
||||||
#: kaehmy/models.py:29
|
#: kaehmy/models.py:24
|
||||||
msgid "Media"
|
msgid "Media"
|
||||||
msgstr "Media"
|
msgstr "Media"
|
||||||
|
|
||||||
#: kaehmy/models.py:30
|
#: kaehmy/models.py:25
|
||||||
msgid "Technology"
|
msgid "Technology"
|
||||||
msgstr "Teknologia"
|
msgstr "Teknologia"
|
||||||
|
|
||||||
#: kaehmy/models.py:31
|
#: kaehmy/models.py:26
|
||||||
msgid "Wellbeing"
|
msgid "Wellbeing"
|
||||||
msgstr "Hyvinvointi"
|
msgstr "Hyvinvointi"
|
||||||
|
|
||||||
#: kaehmy/models.py:32
|
#: kaehmy/models.py:27
|
||||||
msgid "Elepaja"
|
msgid "Elepaja"
|
||||||
msgstr "Elepaja"
|
msgstr "Elepaja"
|
||||||
|
|
||||||
#: kaehmy/models.py:33
|
#: kaehmy/models.py:28
|
||||||
msgid "Ceremonies"
|
msgid "Ceremonies"
|
||||||
msgstr "Hupitapahtumat"
|
msgstr "Hupitapahtumat"
|
||||||
|
|
||||||
#: kaehmy/models.py:34
|
#: kaehmy/models.py:29
|
||||||
msgid "Studies"
|
msgid "Studies"
|
||||||
msgstr "Opinnot"
|
msgstr "Opinnot"
|
||||||
|
|
||||||
#: kaehmy/models.py:35
|
#: kaehmy/models.py:30
|
||||||
msgid "Sössö magazine"
|
msgid "Sössö magazine"
|
||||||
msgstr "Kiltalehti Sössö"
|
msgstr "Kiltalehti Sössö"
|
||||||
|
|
||||||
#: kaehmy/models.py:36
|
#: kaehmy/models.py:31
|
||||||
msgid "Alumni relations"
|
msgid "Alumni relations"
|
||||||
msgstr "Alumnisuhteet"
|
msgstr "Alumnisuhteet"
|
||||||
|
|
||||||
#: kaehmy/models.py:37
|
#: kaehmy/models.py:32
|
||||||
msgid "Others"
|
msgid "Others"
|
||||||
msgstr "Muut"
|
msgstr "Muut"
|
||||||
|
|
||||||
#: kaehmy/models.py:39
|
#: kaehmy/models.py:34
|
||||||
msgid "Category"
|
msgid "Category"
|
||||||
msgstr "Kategoria"
|
msgstr "Kategoria"
|
||||||
|
|
||||||
#: kaehmy/models.py:45
|
#: kaehmy/models.py:40
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr "Kuvaus"
|
msgstr "Kuvaus"
|
||||||
|
|
||||||
#: kaehmy/models.py:48
|
#: kaehmy/models.py:43
|
||||||
msgid "Preset kaehmy role"
|
msgid "Preset kaehmy role"
|
||||||
msgstr "Kaehmyvirka"
|
msgstr "Kaehmyvirka"
|
||||||
|
|
||||||
#: kaehmy/models.py:49
|
#: kaehmy/models.py:44
|
||||||
msgid "Preset kaehmy roles"
|
msgid "Preset kaehmy roles"
|
||||||
msgstr "Kaehmyvirat"
|
msgstr "Kaehmyvirat"
|
||||||
|
|
||||||
#: kaehmy/models.py:56
|
#: kaehmy/models.py:51
|
||||||
msgid "Custom kaehmy role"
|
msgid "Custom kaehmy role"
|
||||||
msgstr "Uusi virka"
|
msgstr "Uusi virka"
|
||||||
|
|
||||||
#: kaehmy/models.py:57
|
#: kaehmy/models.py:52
|
||||||
msgid "Custom kaehmy roles"
|
msgid "Custom kaehmy roles"
|
||||||
msgstr "Uudet kaehmyvirat"
|
msgstr "Uudet kaehmyvirat"
|
||||||
|
|
||||||
#: kaehmy/models.py:63 kaehmy/templates/list.html:40 members/models.py:14
|
#: kaehmy/models.py:58 kaehmy/templates/list.html:40 members/models.py:14
|
||||||
msgid "Email"
|
msgid "Email"
|
||||||
msgstr "Sähköposti"
|
msgstr "Sähköposti"
|
||||||
|
|
||||||
#: kaehmy/models.py:64
|
#: kaehmy/models.py:59
|
||||||
msgid "Timestamp"
|
msgid "Timestamp"
|
||||||
msgstr "Aikaleima"
|
msgstr "Aikaleima"
|
||||||
|
|
||||||
#: kaehmy/models.py:78
|
#: kaehmy/models.py:73
|
||||||
msgid "Kaehmykommentti"
|
msgid "Kaehmykommentti"
|
||||||
msgstr "Kaehmykommentti"
|
msgstr "Kaehmykommentti"
|
||||||
|
|
||||||
#: kaehmy/models.py:79
|
#: kaehmy/models.py:74
|
||||||
msgid "Kaehmykommentit"
|
msgid "Kaehmykommentit"
|
||||||
msgstr "Kaehmykommentit"
|
msgstr "Kaehmykommentit"
|
||||||
|
|
||||||
#: kaehmy/models.py:81 ohlhafv/models.py:36
|
#: kaehmy/models.py:76 ohlhafv/models.py:36
|
||||||
msgid "Message"
|
msgid "Message"
|
||||||
msgstr "Viesti"
|
msgstr "Viesti"
|
||||||
|
|
||||||
#: kaehmy/models.py:100 kaehmy/templates/kaehmy.html:12
|
#: kaehmy/models.py:95 kaehmy/templates/kaehmy.html:12
|
||||||
msgid "Kaehmylomake"
|
msgid "Kaehmylomake"
|
||||||
msgstr "Kaehmylomake"
|
msgstr "Kaehmylomake"
|
||||||
|
|
||||||
#: kaehmy/models.py:101
|
#: kaehmy/models.py:96
|
||||||
msgid "Kaehmylomakkeet"
|
msgid "Kaehmylomakkeet"
|
||||||
msgstr "Kaehmylomakkeet"
|
msgstr "Kaehmylomakkeet"
|
||||||
|
|
||||||
#: kaehmy/models.py:104
|
#: kaehmy/models.py:99
|
||||||
msgid "Phone number"
|
msgid "Phone number"
|
||||||
msgstr "Puhelinnumero"
|
msgstr "Puhelinnumero"
|
||||||
|
|
||||||
#: kaehmy/models.py:105
|
#: kaehmy/models.py:100
|
||||||
msgid "Year"
|
msgid "Year"
|
||||||
msgstr "Vuosi"
|
msgstr "Vuosi"
|
||||||
|
|
||||||
#: kaehmy/models.py:106
|
#: kaehmy/models.py:101
|
||||||
msgid "Text"
|
msgid "Text"
|
||||||
msgstr "Teksti"
|
msgstr "Teksti"
|
||||||
|
|
||||||
#: kaehmy/models.py:108
|
#: kaehmy/models.py:103
|
||||||
msgid "Custom role name"
|
msgid "Custom role name"
|
||||||
msgstr "Uusi virka"
|
msgstr "Uusi virka"
|
||||||
|
|
||||||
#: kaehmy/models.py:110 webapp/models.py:174
|
#: kaehmy/models.py:105 webapp/models.py:177
|
||||||
msgid "Board member"
|
msgid "Board member"
|
||||||
msgstr "Hallituksen jäsen"
|
msgstr "Hallituksen jäsen"
|
||||||
|
|
||||||
#: kaehmy/models.py:118
|
#: kaehmy/models.py:113
|
||||||
msgid "Kaehmy application: {}"
|
msgid "Kaehmy application: {}"
|
||||||
msgstr "Kaehmy: {}"
|
msgstr "Kaehmy: {}"
|
||||||
|
|
||||||
#: kaehmy/models.py:140
|
#: kaehmy/models.py:135
|
||||||
msgid "Board: {}"
|
msgid "Board: {}"
|
||||||
msgstr "Hallitus: {}"
|
msgstr "Hallitus: {}"
|
||||||
|
|
||||||
#: kaehmy/models.py:146
|
#: kaehmy/models.py:141
|
||||||
msgid "Official: {}"
|
msgid "Official: {}"
|
||||||
msgstr "Toimari: {}"
|
msgstr "Toimari: {}"
|
||||||
|
|
||||||
#: kaehmy/models.py:163
|
|
||||||
msgid "Telegram channel"
|
|
||||||
msgstr "Telegram-kanava"
|
|
||||||
|
|
||||||
#: kaehmy/models.py:164
|
|
||||||
msgid "Telegram channels"
|
|
||||||
msgstr "Telegram-kanavat"
|
|
||||||
|
|
||||||
#: kaehmy/tables.py:13
|
#: kaehmy/tables.py:13
|
||||||
msgid "Roles"
|
msgid "Roles"
|
||||||
msgstr "Roolit"
|
msgstr "Roolit"
|
||||||
@@ -404,8 +396,8 @@ msgstr ""
|
|||||||
" Koska lista ei ole koskaan täydellinen, voit myös ehdottaa ihan "
|
" Koska lista ei ole koskaan täydellinen, voit myös ehdottaa ihan "
|
||||||
"uutta toimenkuvaa.\n"
|
"uutta toimenkuvaa.\n"
|
||||||
" Jos sinulla on kysyttävää mistä tahansa virasta, kannattaa "
|
" Jos sinulla on kysyttävää mistä tahansa virasta, kannattaa "
|
||||||
"konsultoida <a href=\"https://static.sahkoinsinoorikilta.fi/uus_webi/kahmyopas.pdf"
|
"konsultoida <a href=\"https://static.sahkoinsinoorikilta.fi/uus_webi/"
|
||||||
"\">kaehmyopasta</a> \n"
|
"kahmyopas.pdf\">kaehmyopasta</a> \n"
|
||||||
" tai olla yhteydessä kyseistä virkaa tänä vuonna toimittavaan "
|
" tai olla yhteydessä kyseistä virkaa tänä vuonna toimittavaan "
|
||||||
"henkilöön."
|
"henkilöön."
|
||||||
|
|
||||||
@@ -430,37 +422,33 @@ msgid "Päivämääriä & deadlineja"
|
|||||||
msgstr "Päivämääriä & deadlineja"
|
msgstr "Päivämääriä & deadlineja"
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:31
|
#: kaehmy/templates/kaehmy.html:31
|
||||||
msgid "Hallitustyrkkypaneeli"
|
msgid "Vaalikokous, osa 1 (puheenjohtajan valinta) ja hallitustyrkkypaneeli"
|
||||||
msgstr ""
|
msgstr "Vaalikokous, osa 1 (puheenjohtajan valinta)"
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:32
|
#: kaehmy/templates/kaehmy.html:32
|
||||||
msgid "Vaalikokous, osa 1 (puheenjohtajan valinta)"
|
msgid "Vaalikokous, osa 2 (hallituksen valinta)"
|
||||||
msgstr "Vaalikokous, osa 1 (puheenjohtajan valinta)"
|
msgstr "Vaalikokous, osa 2 (hallituksen valinta)"
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:33
|
#: kaehmy/templates/kaehmy.html:33
|
||||||
msgid "Toimikunta-appro"
|
msgid "Toimikunta-appro"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:34
|
#: kaehmy/templates/kaehmy.html:34
|
||||||
msgid "Vaalikokous, osa 2 (hallituksen valinta)"
|
|
||||||
msgstr "Vaalikokous, osa 2 (hallituksen valinta)"
|
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:35
|
|
||||||
msgid "Vaalikokous, osa 3 (toimarien valinta)"
|
msgid "Vaalikokous, osa 3 (toimarien valinta)"
|
||||||
msgstr "Vaalikokous, osa 3 (toimarien valinta)"
|
msgstr "Vaalikokous, osa 3 (toimarien valinta)"
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:78
|
#: kaehmy/templates/kaehmy.html:77
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"\n"
|
"\n"
|
||||||
" Hyväksyn <a href=\"https://static.sahkoinsinoorikilta.fi/GDPR/"
|
" Hyväksyn <a href=\"https://static.sahkoinsinoorikilta.fi/"
|
||||||
"Tietosuojaseloste%20%23U2013%20Toimihenkil%23U00f6ksi%20hakemisen"
|
"GDPR/Tietosuojaseloste%%20%%23U2013%%20Toimihenkil%%23U00f6ksi%%20hakemisen"
|
||||||
"%20rekisteri.pdf\" target=\"_blank\">tietosuojaselosteen</a> ja tietojeni "
|
"%%20rekisteri.pdf\" target=\"_blank\">tietosuojaselosteen</a> ja tietojeni "
|
||||||
"tallentamisen.\n"
|
"tallentamisen.\n"
|
||||||
" "
|
" "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: kaehmy/templates/kaehmy.html:84 members/templates/settings.html:23
|
#: kaehmy/templates/kaehmy.html:83 members/templates/settings.html:23
|
||||||
msgid "Submit"
|
msgid "Submit"
|
||||||
msgstr "Lisää"
|
msgstr "Lisää"
|
||||||
|
|
||||||
@@ -637,8 +625,8 @@ msgstr "Hienoa! Jäsenhakemuksesi on nyt lähetetty."
|
|||||||
|
|
||||||
#: members/templates/application_success.html:9
|
#: members/templates/application_success.html:9
|
||||||
msgid ""
|
msgid ""
|
||||||
"Vahvistusviesti on lähetetty sähköpostiisi. Ota yhteyttä admin@sahkoinsinoorikilta.fi."
|
"Vahvistusviesti on lähetetty sähköpostiisi. Ota yhteyttä "
|
||||||
"fi jos viestiä ei näy."
|
"admin@sahkoinsinoorikilta.fi jos viestiä ei näy."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: members/templates/application_success.html:10
|
#: members/templates/application_success.html:10
|
||||||
@@ -905,11 +893,11 @@ msgstr "Maksutapahtumia:"
|
|||||||
msgid "Language"
|
msgid "Language"
|
||||||
msgstr "Kieli"
|
msgstr "Kieli"
|
||||||
|
|
||||||
#: members/templates/settings.html:20 sikweb/base.py:217
|
#: members/templates/settings.html:20 sikweb/base.py:216
|
||||||
msgid "Finnish"
|
msgid "Finnish"
|
||||||
msgstr "suomi"
|
msgstr "suomi"
|
||||||
|
|
||||||
#: members/templates/settings.html:21 sikweb/base.py:218
|
#: members/templates/settings.html:21 sikweb/base.py:217
|
||||||
msgid "English"
|
msgid "English"
|
||||||
msgstr "englanti"
|
msgstr "englanti"
|
||||||
|
|
||||||
@@ -1018,11 +1006,11 @@ msgstr "Øhlhäfv"
|
|||||||
|
|
||||||
#: ohlhafv/models.py:22
|
#: ohlhafv/models.py:22
|
||||||
msgid "Ohlhafv challenge"
|
msgid "Ohlhafv challenge"
|
||||||
msgstr "Ohlhafv haaste"
|
msgstr "Øhlhäfv-haaste"
|
||||||
|
|
||||||
#: ohlhafv/models.py:23
|
#: ohlhafv/models.py:23
|
||||||
msgid "Ohlhafv challenges"
|
msgid "Ohlhafv challenges"
|
||||||
msgstr "Ohlhafv haasteet"
|
msgstr "Øhlhäfv-haasteet"
|
||||||
|
|
||||||
#: ohlhafv/models.py:29
|
#: ohlhafv/models.py:29
|
||||||
msgid "Team Challenge (1 x 0.33 L, 2 x 0.5 L, 1 x 1.0 L)"
|
msgid "Team Challenge (1 x 0.33 L, 2 x 0.5 L, 1 x 1.0 L)"
|
||||||
@@ -1046,7 +1034,7 @@ msgstr "Sarja"
|
|||||||
|
|
||||||
#: ohlhafv/models.py:40
|
#: ohlhafv/models.py:40
|
||||||
msgid "Ohlhafv challenge: {} vs. {}"
|
msgid "Ohlhafv challenge: {} vs. {}"
|
||||||
msgstr "Ohlhafv-haaste: {} vs. {}"
|
msgstr "Øhlhäfv-haaste: {} vs. {}"
|
||||||
|
|
||||||
#: ohlhafv/templates/email.html:4
|
#: ohlhafv/templates/email.html:4
|
||||||
msgid "on haastanut sinut oluenjuontimittelöön"
|
msgid "on haastanut sinut oluenjuontimittelöön"
|
||||||
@@ -1101,91 +1089,131 @@ msgstr "Vaihda"
|
|||||||
msgid "Aalto-yliopiston Sähköinsinöörikilta ry"
|
msgid "Aalto-yliopiston Sähköinsinöörikilta ry"
|
||||||
msgstr "Aalto-yliopiston Sähköinsinöörikilta ry"
|
msgstr "Aalto-yliopiston Sähköinsinöörikilta ry"
|
||||||
|
|
||||||
#: webapp/models.py:18
|
#: webapp/models.py:21
|
||||||
msgid "Webapp"
|
msgid "Webapp"
|
||||||
msgstr "Nettisivut"
|
msgstr "Nettisivut"
|
||||||
|
|
||||||
#: webapp/models.py:26
|
#: webapp/models.py:29
|
||||||
msgid "Tag"
|
msgid "Tag"
|
||||||
msgstr "Tunniste"
|
msgstr "Tunniste"
|
||||||
|
|
||||||
#: webapp/models.py:27
|
#: webapp/models.py:30
|
||||||
msgid "Tags"
|
msgid "Tags"
|
||||||
msgstr "Tunnisteet"
|
msgstr "Tunnisteet"
|
||||||
|
|
||||||
#: webapp/models.py:34
|
#: webapp/models.py:37
|
||||||
msgid "Tag: {}"
|
msgid "Tag: {}"
|
||||||
msgstr "Tunniste: {}"
|
msgstr "Tunniste: {}"
|
||||||
|
|
||||||
#: webapp/models.py:52
|
#: webapp/models.py:55
|
||||||
msgid "Feed"
|
msgid "Feed"
|
||||||
msgstr "Uutinen"
|
msgstr "Uutinen"
|
||||||
|
|
||||||
#: webapp/models.py:53
|
#: webapp/models.py:56
|
||||||
msgid "Feeds"
|
msgid "Feeds"
|
||||||
msgstr "Uutiset"
|
msgstr "Uutiset"
|
||||||
|
|
||||||
#: webapp/models.py:61 webapp/models.py:80 webapp/models.py:119
|
#: webapp/models.py:64 webapp/models.py:83 webapp/models.py:122
|
||||||
#: webapp/models.py:152 webapp/models.py:198
|
#: webapp/models.py:155 webapp/models.py:201
|
||||||
msgid "Deleted: "
|
msgid "Deleted: "
|
||||||
msgstr "Poistettu: "
|
msgstr "Poistettu: "
|
||||||
|
|
||||||
#: webapp/models.py:62
|
#: webapp/models.py:65
|
||||||
msgid "{}Feed: {}"
|
msgid "{}Feed: {}"
|
||||||
msgstr "{}Uutinen: {}"
|
msgstr "{}Uutinen: {}"
|
||||||
|
|
||||||
#: webapp/models.py:69
|
#: webapp/models.py:72
|
||||||
msgid "Event"
|
msgid "Event"
|
||||||
msgstr "Tapahtuma"
|
msgstr "Tapahtuma"
|
||||||
|
|
||||||
#: webapp/models.py:81
|
#: webapp/models.py:84
|
||||||
msgid "{}Event: {}"
|
msgid "{}Event: {}"
|
||||||
msgstr "{}Tapahtuma: {}"
|
msgstr "{}Tapahtuma: {}"
|
||||||
|
|
||||||
#: webapp/models.py:91
|
#: webapp/models.py:93
|
||||||
msgid "Template question"
|
msgid "Template question"
|
||||||
msgstr "Vakiokysymys"
|
msgstr "Vakiokysymys"
|
||||||
|
|
||||||
#: webapp/models.py:92
|
#: webapp/models.py:94
|
||||||
msgid "Template questions"
|
msgid "Template questions"
|
||||||
msgstr "Vakiokysymykset"
|
msgstr "Vakiokysymykset"
|
||||||
|
|
||||||
#: webapp/models.py:98
|
#: webapp/models.py:101
|
||||||
msgid "Template questions: {}"
|
msgid "Template questions: {}"
|
||||||
msgstr "Vakiokysymykset: {}"
|
msgstr "Vakiokysymykset: {}"
|
||||||
|
|
||||||
#: webapp/models.py:105
|
#: webapp/models.py:108
|
||||||
msgid "Signup form"
|
msgid "Signup form"
|
||||||
msgstr "Ilmoittautumislomake"
|
msgstr "Ilmoittautumislomake"
|
||||||
|
|
||||||
#: webapp/models.py:106
|
#: webapp/models.py:109
|
||||||
msgid "Signup forms"
|
msgid "Signup forms"
|
||||||
msgstr "Ilmoittautumislomakkeet"
|
msgstr "Ilmoittautumislomakkeet"
|
||||||
|
|
||||||
#: webapp/models.py:120
|
#: webapp/models.py:123
|
||||||
msgid "#{} {}{}"
|
msgid "#{} {}{}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: webapp/models.py:138
|
#: webapp/models.py:141
|
||||||
msgid "Sign-up"
|
msgid "Sign-up"
|
||||||
msgstr "Ilmoittautuminen"
|
msgstr "Ilmoittautuminen"
|
||||||
|
|
||||||
#: webapp/models.py:139
|
#: webapp/models.py:142
|
||||||
msgid "Sign-ups"
|
msgid "Sign-ups"
|
||||||
msgstr "Ilmoittautumiset"
|
msgstr "Ilmoittautumiset"
|
||||||
|
|
||||||
#: webapp/models.py:178
|
#: webapp/models.py:181
|
||||||
msgid "board member"
|
msgid "board member"
|
||||||
msgstr "hallituksen jäsen"
|
msgstr "hallituksen jäsen"
|
||||||
|
|
||||||
#: webapp/models.py:185
|
#: webapp/models.py:188
|
||||||
msgid "JobAd"
|
msgid "JobAd"
|
||||||
msgstr "Työpaikkailmoitus"
|
msgstr "Työpaikkailmoitus"
|
||||||
|
|
||||||
#: webapp/models.py:186
|
#: webapp/models.py:189
|
||||||
msgid "JobAds"
|
msgid "JobAds"
|
||||||
msgstr "Työpaikkailmoitukset"
|
msgstr "Työpaikkailmoitukset"
|
||||||
|
|
||||||
|
#: webapp/models.py:211
|
||||||
|
msgid "Hook Kaehmys"
|
||||||
|
msgstr "Lähetä Kähmyt"
|
||||||
|
|
||||||
|
#: webapp/models.py:212
|
||||||
|
msgid "Hook Ohlhafv challenges"
|
||||||
|
msgstr "Lähetä Øhlhäfv-haasteet"
|
||||||
|
|
||||||
|
#: webapp/models.py:213
|
||||||
|
msgid "Hook published news"
|
||||||
|
msgstr "Lähetä julkaistut uutiset"
|
||||||
|
|
||||||
|
#: webapp/models.py:214
|
||||||
|
msgid "Hook published Job Ads"
|
||||||
|
msgstr "Lähetä työpaikkailmoitukset"
|
||||||
|
|
||||||
|
#: webapp/models.py:215
|
||||||
|
msgid "Hook published events"
|
||||||
|
msgstr "Lähetä julkaistut tapahtumat"
|
||||||
|
|
||||||
|
#: webapp/models.py:216
|
||||||
|
msgid "Hook opened signups"
|
||||||
|
msgstr "Lähetä auenneet ilmot"
|
||||||
|
|
||||||
|
#: webapp/models.py:241
|
||||||
|
msgid "Webhook"
|
||||||
|
msgstr "Webhook"
|
||||||
|
|
||||||
|
#: webapp/models.py:242
|
||||||
|
msgid "Webhooks"
|
||||||
|
msgstr "Webhookit"
|
||||||
|
|
||||||
|
#: webapp/models.py:256
|
||||||
|
msgid "Telegram channel"
|
||||||
|
msgstr "Telegram-kanava"
|
||||||
|
|
||||||
|
#: webapp/models.py:257
|
||||||
|
msgid "Telegram channels"
|
||||||
|
msgstr "Telegram-kanavat"
|
||||||
|
|
||||||
#: webapp/templates/contact.html:9 webapp/templates/navigation.html:20
|
#: webapp/templates/contact.html:9 webapp/templates/navigation.html:20
|
||||||
msgid "Contact"
|
msgid "Contact"
|
||||||
msgstr "Yhteystiedot"
|
msgstr "Yhteystiedot"
|
||||||
|
|||||||
+6
-7
@@ -20,7 +20,7 @@ from ohlhafv.models import OhlhafvChallenge
|
|||||||
from ohlhafv.forms import OhlhafvForm
|
from ohlhafv.forms import OhlhafvForm
|
||||||
from ohlhafv.tables import OhlhafvTable
|
from ohlhafv.tables import OhlhafvTable
|
||||||
from webapp.utils import send_email
|
from webapp.utils import send_email
|
||||||
from kaehmy.tgbot import TelegramBot
|
from webapp.webhook import processHooks
|
||||||
|
|
||||||
|
|
||||||
@require_http_methods(["GET"])
|
@require_http_methods(["GET"])
|
||||||
@@ -43,22 +43,21 @@ def ohlhafv_submit(request, *args, **kwargs):
|
|||||||
url = f'https://{URL}/ohlhafv/list'
|
url = f'https://{URL}/ohlhafv/list'
|
||||||
subject = _('Sinut on haastettu Ohlhäfviin!')
|
subject = _('Sinut on haastettu Ohlhäfviin!')
|
||||||
|
|
||||||
message = render_to_string(
|
email_body = render_to_string(
|
||||||
'ohlhafv:email.html', {
|
'ohlhafv:email.html', {
|
||||||
'challenge': challenge,
|
'challenge': challenge,
|
||||||
'url': url,
|
'url': url,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
send_email(email, subject, message)
|
send_email(email, subject, email_body)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tg_message = render_to_string(
|
webhook_message = render_to_string(
|
||||||
'ohlhafv:tgmsg.tpl', {
|
'ohlhafv:tgmsg.tpl', {
|
||||||
'challenge': challenge,
|
'challenge': challenge,
|
||||||
'url': url})
|
'url': url})
|
||||||
bot = TelegramBot()
|
processHooks(message=webhook_message, eventType="ohlhafv")
|
||||||
bot.broadcast(tg_message)
|
except Exception:
|
||||||
except Exception: # tg spam is not critical. Ignore on failure
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
logging.debug(
|
logging.debug(
|
||||||
|
|||||||
Generated
+16
-1
@@ -243,6 +243,17 @@ phonenumbers = {version = ">=7.0.2", optional = true, markers = "extra == \"phon
|
|||||||
phonenumbers = ["phonenumbers (>=7.0.2)"]
|
phonenumbers = ["phonenumbers (>=7.0.2)"]
|
||||||
phonenumberslite = ["phonenumberslite (>=7.0.2)"]
|
phonenumberslite = ["phonenumberslite (>=7.0.2)"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "django-polymorphic"
|
||||||
|
version = "3.1.0"
|
||||||
|
description = "Seamless polymorphic inheritance for Django models"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
Django = ">=2.1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "django-suit"
|
name = "django-suit"
|
||||||
version = "0.2.28"
|
version = "0.2.28"
|
||||||
@@ -763,7 +774,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "1.1"
|
lock-version = "1.1"
|
||||||
python-versions = "^3.9"
|
python-versions = "^3.9"
|
||||||
content-hash = "755a353d6f70eab1933125429b38d1e7249f57a9a61769507a3ef624f2d3cddb"
|
content-hash = "9d958b16dbad0528e51f6e4a2022cb13fbd5c210ef5e4d9d898afdae373ad470"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
attrs = [
|
attrs = [
|
||||||
@@ -900,6 +911,10 @@ django-phonenumber-field = [
|
|||||||
{file = "django-phonenumber-field-4.0.0.tar.gz", hash = "sha256:d4580cc3352f4433962825f9927e6669852c1b40ec484fcb5a74064dabc1201a"},
|
{file = "django-phonenumber-field-4.0.0.tar.gz", hash = "sha256:d4580cc3352f4433962825f9927e6669852c1b40ec484fcb5a74064dabc1201a"},
|
||||||
{file = "django_phonenumber_field-4.0.0-py3-none-any.whl", hash = "sha256:2ca3bb0ada0ebc164bd903a981a34f1202a4294006e520b0da961bd7ce9f20a4"},
|
{file = "django_phonenumber_field-4.0.0-py3-none-any.whl", hash = "sha256:2ca3bb0ada0ebc164bd903a981a34f1202a4294006e520b0da961bd7ce9f20a4"},
|
||||||
]
|
]
|
||||||
|
django-polymorphic = [
|
||||||
|
{file = "django-polymorphic-3.1.0.tar.gz", hash = "sha256:d6955b5308bf6e41dcb22ba7c96f00b51dfa497a8a5ab1e9c06c7951bf417bf8"},
|
||||||
|
{file = "django_polymorphic-3.1.0-py3-none-any.whl", hash = "sha256:08bc4f4f4a773a19b2deced5a56deddd1ef56ebd15207bf4052e2901c25ef57e"},
|
||||||
|
]
|
||||||
django-suit = [
|
django-suit = [
|
||||||
{file = "django-suit-0.2.28.tar.gz", hash = "sha256:bacd8a079fcc08deb6efd0d7f60241e3c319526939ae1abe8ccfbc1b03e97104"},
|
{file = "django-suit-0.2.28.tar.gz", hash = "sha256:bacd8a079fcc08deb6efd0d7f60241e3c319526939ae1abe8ccfbc1b03e97104"},
|
||||||
{file = "django_suit-0.2.28-py2.py3-none-any.whl", hash = "sha256:256412597ac8e9461780542eebb12b37f65ff702bf23de23d07d245510c64ff2"},
|
{file = "django_suit-0.2.28-py2.py3-none-any.whl", hash = "sha256:256412597ac8e9461780542eebb12b37f65ff702bf23de23d07d245510c64ff2"},
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ gunicorn = "^20.1.0"
|
|||||||
Pillow = "^8.4.0"
|
Pillow = "^8.4.0"
|
||||||
sendgrid = "^6.7.0"
|
sendgrid = "^6.7.0"
|
||||||
sentry-sdk = "^1.4.3"
|
sentry-sdk = "^1.4.3"
|
||||||
|
django-polymorphic = "^3.1.0"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
coverage = "^5.5"
|
coverage = "^5.5"
|
||||||
|
|||||||
+3
-1
@@ -1,7 +1,7 @@
|
|||||||
"""File containing webapp app admin registers."""
|
"""File containing webapp app admin registers."""
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from webapp.models import Feed, Tag, Event, Signup, SignupForm, TemplateQuestion, JobAd
|
from webapp.models import Feed, Tag, Event, Signup, SignupForm, TemplateQuestion, JobAd, BaseWebhook, GenericWebhook, TelegramHook
|
||||||
from modeltranslation.admin import TranslationAdmin
|
from modeltranslation.admin import TranslationAdmin
|
||||||
from django.contrib.auth.models import Permission
|
from django.contrib.auth.models import Permission
|
||||||
# this is needed so that the models get registered for translation
|
# this is needed so that the models get registered for translation
|
||||||
@@ -16,3 +16,5 @@ admin.site.register(SignupForm, TranslationAdmin)
|
|||||||
admin.site.register(Signup, TranslationAdmin)
|
admin.site.register(Signup, TranslationAdmin)
|
||||||
admin.site.register(TemplateQuestion, TranslationAdmin)
|
admin.site.register(TemplateQuestion, TranslationAdmin)
|
||||||
admin.site.register(JobAd, TranslationAdmin)
|
admin.site.register(JobAd, TranslationAdmin)
|
||||||
|
admin.site.register(GenericWebhook, TranslationAdmin)
|
||||||
|
admin.site.register(TelegramHook, TranslationAdmin)
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
# Generated by Django 2.2.26 on 2022-01-12 21:32
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('contenttypes', '0002_remove_content_type_name'),
|
||||||
|
('webapp', '0077_templatequestion_deleted'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='BaseWebhook',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=255)),
|
||||||
|
('url', models.URLField()),
|
||||||
|
('kaehmy_submit', models.BooleanField(default=False)),
|
||||||
|
('ohlhafv_submit', models.BooleanField(default=False)),
|
||||||
|
('feed_published', models.BooleanField(default=False)),
|
||||||
|
('jobad_published', models.BooleanField(default=False)),
|
||||||
|
('event_published', models.BooleanField(default=False)),
|
||||||
|
('signup_opened', models.BooleanField(default=False)),
|
||||||
|
('polymorphic_ctype', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_webapp.basewebhook_set+', to='contenttypes.ContentType')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
'base_manager_name': 'objects',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='TelegramHook',
|
||||||
|
fields=[
|
||||||
|
('basewebhook_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='webapp.BaseWebhook')),
|
||||||
|
('channel_id', models.CharField(max_length=255, unique=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Telegram channel',
|
||||||
|
'verbose_name_plural': 'Telegram channels',
|
||||||
|
},
|
||||||
|
bases=('webapp.basewebhook',),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='GenericWebhook',
|
||||||
|
fields=[
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Webhook',
|
||||||
|
'verbose_name_plural': 'Webhooks',
|
||||||
|
'proxy': True,
|
||||||
|
'indexes': [],
|
||||||
|
'constraints': [],
|
||||||
|
},
|
||||||
|
bases=('webapp.basewebhook',),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -2,16 +2,19 @@
|
|||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.db.models.fields import CharField
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
# from datetime import timedelta
|
# from datetime import timedelta
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.db.models.signals import post_save
|
from django.db.models.signals import post_save
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
|
import requests
|
||||||
from webapp.utils import month_from_now, send_signup_email
|
from webapp.utils import month_from_now, send_signup_email
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from auditlog.registry import auditlog
|
from auditlog.registry import auditlog
|
||||||
from phonenumber_field.modelfields import PhoneNumberField
|
from phonenumber_field.modelfields import PhoneNumberField
|
||||||
from django.contrib.postgres.fields import JSONField
|
from django.contrib.postgres.fields import JSONField
|
||||||
|
from polymorphic.models import PolymorphicModel
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@@ -199,9 +202,78 @@ class JobAd(models.Model):
|
|||||||
return f'{delete_str}{self.title}'
|
return f'{delete_str}{self.title}'
|
||||||
|
|
||||||
|
|
||||||
|
class BaseWebhook(PolymorphicModel):
|
||||||
|
"""Webhook base class instance"""
|
||||||
|
|
||||||
|
name = models.CharField(max_length=255)
|
||||||
|
url = models.URLField() # URL where webhook message is broadcast. For example Telegram webhook API
|
||||||
|
# "Plugs"; which notifications are sent to this specific webhook instance
|
||||||
|
kaehmy_submit = models.BooleanField(_("Hook Kaehmys"), default=False)
|
||||||
|
ohlhafv_submit = models.BooleanField(_("Hook Ohlhafv challenges"),default=False)
|
||||||
|
feed_published = models.BooleanField(_("Hook published news"),default=False)
|
||||||
|
jobad_published = models.BooleanField(_("Hook published Job Ads"),default=False)
|
||||||
|
event_published = models.BooleanField(_("Hook published events"),default=False)
|
||||||
|
signup_opened = models.BooleanField(_("Hook opened signups"),default=False)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def plugs(self):
|
||||||
|
return {
|
||||||
|
"kaehmy": self.kaehmy_submit,
|
||||||
|
"ohlhafv": self.ohlhafv_submit,
|
||||||
|
"feed": self.feed_published,
|
||||||
|
"jobad": self.jobad_published,
|
||||||
|
"event": self.event_published,
|
||||||
|
"signup":self.signup_opened,
|
||||||
|
}
|
||||||
|
|
||||||
|
def parseData(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def broadcast(self, message):
|
||||||
|
resp = requests.post(self.url, json=self.parseData(message))
|
||||||
|
logging.debug(f'Webhook API response: HTTP{resp.status_code}')
|
||||||
|
logging.debug(resp.content)
|
||||||
|
|
||||||
|
|
||||||
|
class GenericWebhook(BaseWebhook):
|
||||||
|
class Meta:
|
||||||
|
proxy = True
|
||||||
|
verbose_name = _('Webhook')
|
||||||
|
verbose_name_plural = _('Webhooks')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return 'Webhook "{}"'.format(self.name)
|
||||||
|
|
||||||
|
def parseData(self, message):
|
||||||
|
return {
|
||||||
|
"text": message
|
||||||
|
}
|
||||||
|
|
||||||
|
class TelegramHook(BaseWebhook):
|
||||||
|
"""Model containing the channel id of a Telegram chat"""
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = _('Telegram channel')
|
||||||
|
verbose_name_plural = _('Telegram channels')
|
||||||
|
|
||||||
|
channel_id = models.CharField(max_length=255, unique=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return 'Telegram channel: "{}"'.format(self.name)
|
||||||
|
|
||||||
|
def parseData(self, message):
|
||||||
|
return {
|
||||||
|
'text': message,
|
||||||
|
'chat_id': self.channel_id,
|
||||||
|
'parse_mode': 'Markdown'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
auditlog.register(Tag)
|
auditlog.register(Tag)
|
||||||
auditlog.register(Feed)
|
auditlog.register(Feed)
|
||||||
auditlog.register(Event)
|
auditlog.register(Event)
|
||||||
auditlog.register(SignupForm)
|
auditlog.register(SignupForm)
|
||||||
auditlog.register(Signup)
|
auditlog.register(Signup)
|
||||||
auditlog.register(JobAd)
|
auditlog.register(JobAd)
|
||||||
|
auditlog.register(GenericWebhook)
|
||||||
|
auditlog.register(TelegramHook)
|
||||||
|
|||||||
@@ -42,3 +42,18 @@ class TemplateQuestionTranslationOptions(TranslationOptions):
|
|||||||
@register(JobAd)
|
@register(JobAd)
|
||||||
class JobAdTranslationOptions(TranslationOptions):
|
class JobAdTranslationOptions(TranslationOptions):
|
||||||
fields = ('title', 'description', 'content',)
|
fields = ('title', 'description', 'content',)
|
||||||
|
|
||||||
|
|
||||||
|
@register(BaseWebhook)
|
||||||
|
class BaseWebhookOptions(TranslationOptions):
|
||||||
|
fields = ()
|
||||||
|
|
||||||
|
|
||||||
|
@register(GenericWebhook)
|
||||||
|
class GenericWebhookOptions(TranslationOptions):
|
||||||
|
fields = ()
|
||||||
|
|
||||||
|
|
||||||
|
@register(TelegramHook)
|
||||||
|
class TelegramHookTranslationOptions(TranslationOptions):
|
||||||
|
fields = ()
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
from webapp.models import BaseWebhook
|
||||||
|
import logging
|
||||||
|
|
||||||
|
def processHooks(message: str, eventType: str):
|
||||||
|
allHooks = BaseWebhook.objects.all()
|
||||||
|
for hook in list(allHooks):
|
||||||
|
logging.debug(hook)
|
||||||
|
if (hook.plugs[eventType] == True):
|
||||||
|
hook.broadcast(message)
|
||||||
Reference in New Issue
Block a user