Merge branch 'develop' into 'master'

Develop

See merge request !75
This commit is contained in:
Jan Tuomi
2017-10-18 12:17:03 +03:00
9 changed files with 241 additions and 111 deletions
Binary file not shown.
+81 -65
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-17 19:55+0300\n"
"POT-Creation-Date: 2017-10-18 12:06+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -168,7 +168,7 @@ msgid "id"
msgstr "id"
#: infoscreen/templates/infoscreen_admin.html:141 webapp/models.py:110
#: webapp/models.py:144 webapp/templates/kaehmy_list.html:40
#: webapp/models.py:144 webapp/templates/kaehmy_list.html:36
msgid "Name"
msgstr "Name"
@@ -192,11 +192,9 @@ msgid "English"
msgstr "English"
#: infoscreen/templates/infoscreen_admin.html:166
#: members/templates/settings.html:23 webapp/templates/kaehmy.html:65
#, fuzzy
#| msgid "Submitted"
#: members/templates/settings.html:23 webapp/templates/kaehmy.html:77
msgid "Submit"
msgstr "Submitted"
msgstr "Submit"
#: members/forms.py:115 members/tables.py:32
msgid "Member"
@@ -211,7 +209,7 @@ msgid "Last name"
msgstr "Last name"
#: members/models.py:16 webapp/models.py:145
#: webapp/templates/kaehmy_list.html:44
#: webapp/templates/kaehmy_list.html:40
msgid "Email"
msgstr "Email"
@@ -353,7 +351,7 @@ msgstr ""
#: members/templates/member_add_many.html:48
#: members/templates/member_add_many_confirm.html:22
#: webapp/templates/kaehmy_list.html:52
#: webapp/templates/kaehmy_list.html:48
msgid "Send"
msgstr "Send"
@@ -551,16 +549,12 @@ msgid "Phone number (not public)"
msgstr ""
#: webapp/forms.py:44
#, fuzzy
#| msgid "Total challenges:"
msgid "Custom roles"
msgstr "Total challenges:"
msgstr ""
#: webapp/forms.py:52 webapp/templates/kaehmy.html:41
#, fuzzy
#| msgid "Total challenges:"
msgid "Preset roles"
msgstr "Total challenges:"
msgstr ""
#: webapp/forms.py:76
msgid "Invalid phone number"
@@ -599,38 +593,28 @@ msgid "Feeds"
msgstr ""
#: webapp/models.py:68
#, fuzzy
#| msgid "Events"
msgid "Event: {}"
msgstr "Events"
msgstr ""
#: webapp/models.py:71
#, fuzzy
#| msgid "Events"
msgid "Event"
msgstr "Events"
msgstr ""
#: webapp/models.py:83
msgid "Registration: {}"
msgstr ""
#: webapp/models.py:86
#, fuzzy
#| msgid "Rotation"
msgid "Registration"
msgstr "Rotation"
msgstr ""
#: webapp/models.py:87
#, fuzzy
#| msgid "Rotations"
msgid "Registrations"
msgstr "Rotations"
msgstr ""
#: webapp/models.py:94
#, fuzzy
#| msgid "Corporate"
msgid "Corporate affairs"
msgstr "Corporate"
msgstr ""
#: webapp/models.py:95 webapp/templates/freshmen.html:7
#: webapp/templates/navigation.html:16
@@ -643,10 +627,8 @@ msgid "International"
msgstr "International"
#: webapp/models.py:97
#, fuzzy
#| msgid "External image"
msgid "External affairs"
msgstr "External image"
msgstr ""
#: webapp/models.py:98
msgid "Media"
@@ -692,7 +674,7 @@ msgstr "Applications"
msgid "Others"
msgstr ""
#: webapp/models.py:111 webapp/models.py:184
#: webapp/models.py:111 webapp/models.py:192
#, fuzzy
#| msgid "Add member"
msgid "Board member"
@@ -742,60 +724,92 @@ msgstr "Total challenges:"
msgid "Custom kaehmy roles"
msgstr "Total challenges:"
#: webapp/models.py:158
msgid "Message"
msgstr ""
#: webapp/models.py:160
#: webapp/models.py:146
msgid "Timestamp"
msgstr ""
#: webapp/models.py:178 webapp/models.py:249
#: webapp/models.py:160
msgid "Kaehmykommentti"
msgstr "Kaehmy comment"
#: webapp/models.py:161
msgid "Kaehmykommentit"
msgstr "Kaehmy comments"
#: webapp/models.py:163
msgid "Message"
msgstr ""
#: webapp/models.py:182 webapp/templates/kaehmy.html:12
msgid "Kaehmylomake"
msgstr "Kaehmy application"
#: webapp/models.py:183
msgid "Kaehmylomakkeet"
msgstr "Kaehmy applications"
#: webapp/models.py:186 webapp/models.py:259
msgid "Phone number"
msgstr ""
#: webapp/models.py:179
#: webapp/models.py:187
msgid "Year"
msgstr ""
#: webapp/models.py:180
#: webapp/models.py:188
msgid "Text"
msgstr ""
#: webapp/models.py:182
#: webapp/models.py:190
msgid "Custom role name"
msgstr ""
#: webapp/models.py:192
#: webapp/models.py:200
#, fuzzy
#| msgid "Member applications"
msgid "Kaehmy application: {}"
msgstr "Member applications"
#: webapp/models.py:214
#: webapp/models.py:222
msgid "Board: {}"
msgstr ""
#: webapp/models.py:220
#: webapp/models.py:228
msgid "Official: {}"
msgstr ""
#: webapp/models.py:234
#: webapp/models.py:242
msgid "Role"
msgstr ""
#: webapp/models.py:236
#: webapp/models.py:243
msgid "Roles"
msgstr ""
#: webapp/models.py:245
msgid "Start date"
msgstr ""
#: webapp/models.py:237
#: webapp/models.py:246
msgid "End date"
msgstr ""
#: webapp/models.py:247
#: webapp/models.py:256
msgid "Official"
msgstr ""
#: webapp/models.py:257
msgid "Officials"
msgstr ""
#: webapp/models.py:285
msgid "Telegram channel"
msgstr ""
#: webapp/models.py:286
msgid "Telegram channels"
msgstr ""
#: webapp/templates/admin_index.html:6
msgid "SIK Admin"
msgstr "SIK Admin"
@@ -820,10 +834,6 @@ msgstr "Guild"
msgid "Jobs"
msgstr "Jobs"
#: webapp/templates/kaehmy.html:12
msgid "Kaehmylomake"
msgstr "Kaehmy application"
#: webapp/templates/kaehmy.html:16
msgid ""
"Kaehmykoneella voit ilmaista kiinnostuksesi toimia killassa ensi vuonna.\n"
@@ -881,28 +891,34 @@ msgstr "Deadline to apply as a non-board official!"
msgid "Vaalikokous, osa 3 (toimarien valinta)"
msgstr "Election meeting, part 3 (non-board election)"
#: webapp/templates/kaehmy_list.html:24
#: webapp/templates/kaehmy_list.html:24 webapp/templates/kaehmy_list.html:59
msgid "All kaehmys"
msgstr "All applications"
#: webapp/templates/kaehmy_list.html:28
#: webapp/templates/kaehmy_list.html:32
msgid "Commenting on post by "
msgstr ""
#: webapp/templates/kaehmy_list.html:44
msgid "Comment"
msgstr ""
#: webapp/templates/kaehmy_list.html:57
#, fuzzy
#| msgid "List kaehmys"
msgid "Filter kaehmys"
msgstr "List applications"
#: webapp/templates/kaehmy_list.html:70
#: webapp/templates/kaehmy_statistics.html:18
msgid "Total kaehmys:"
msgstr "Total applications:"
#: webapp/templates/kaehmy_list.html:36
msgid "Commenting on post by "
msgstr ""
#: webapp/templates/kaehmy_list.html:48
msgid "Comment"
msgstr ""
#: webapp/templates/kaehmy_list.html:73
#: webapp/templates/kaehmy_list.html:88
msgid "Show comments"
msgstr ""
#: webapp/templates/kaehmy_list.html:79
#: webapp/templates/kaehmy_list.html:94
msgid "Add comment"
msgstr ""
Binary file not shown.
+70 -38
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-17 19:55+0300\n"
"POT-Creation-Date: 2017-10-18 12:06+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -169,7 +169,7 @@ msgid "id"
msgstr "id"
#: infoscreen/templates/infoscreen_admin.html:141 webapp/models.py:110
#: webapp/models.py:144 webapp/templates/kaehmy_list.html:40
#: webapp/models.py:144 webapp/templates/kaehmy_list.html:36
msgid "Name"
msgstr "Nimi"
@@ -193,7 +193,7 @@ msgid "English"
msgstr "englanti"
#: infoscreen/templates/infoscreen_admin.html:166
#: members/templates/settings.html:23 webapp/templates/kaehmy.html:65
#: members/templates/settings.html:23 webapp/templates/kaehmy.html:77
msgid "Submit"
msgstr "Lisää"
@@ -210,7 +210,7 @@ msgid "Last name"
msgstr "Sukunimi"
#: members/models.py:16 webapp/models.py:145
#: webapp/templates/kaehmy_list.html:44
#: webapp/templates/kaehmy_list.html:40
msgid "Email"
msgstr "Sähköposti"
@@ -356,7 +356,7 @@ msgstr ""
#: members/templates/member_add_many.html:48
#: members/templates/member_add_many_confirm.html:22
#: webapp/templates/kaehmy_list.html:52
#: webapp/templates/kaehmy_list.html:48
msgid "Send"
msgstr "Lähetä"
@@ -673,7 +673,7 @@ msgstr "Alumnisuhteet"
msgid "Others"
msgstr "Muut"
#: webapp/models.py:111 webapp/models.py:184
#: webapp/models.py:111 webapp/models.py:192
msgid "Board member"
msgstr "Hallituksen jäsen"
@@ -709,58 +709,90 @@ msgstr "Uusi virka"
msgid "Custom kaehmy roles"
msgstr "Uudet kaehmyvirat"
#: webapp/models.py:158
msgid "Message"
msgstr "Viesti"
#: webapp/models.py:160
#: webapp/models.py:146
msgid "Timestamp"
msgstr "Aikaleima"
#: webapp/models.py:178 webapp/models.py:249
#: webapp/models.py:160
msgid "Kaehmykommentti"
msgstr ""
#: webapp/models.py:161
msgid "Kaehmykommentit"
msgstr ""
#: webapp/models.py:163
msgid "Message"
msgstr "Viesti"
#: webapp/models.py:182 webapp/templates/kaehmy.html:12
msgid "Kaehmylomake"
msgstr "Kaehmylomake"
#: webapp/models.py:183
msgid "Kaehmylomakkeet"
msgstr ""
#: webapp/models.py:186 webapp/models.py:259
msgid "Phone number"
msgstr "Puhelinnumero"
#: webapp/models.py:179
#: webapp/models.py:187
msgid "Year"
msgstr "Vuosi"
#: webapp/models.py:180
#: webapp/models.py:188
msgid "Text"
msgstr "Teksti"
#: webapp/models.py:182
#: webapp/models.py:190
msgid "Custom role name"
msgstr "Uusi virka"
#: webapp/models.py:192
#: webapp/models.py:200
msgid "Kaehmy application: {}"
msgstr "Kaehmy: {}"
#: webapp/models.py:214
#: webapp/models.py:222
msgid "Board: {}"
msgstr "Hallitus: {}"
#: webapp/models.py:220
#: webapp/models.py:228
msgid "Official: {}"
msgstr "Toimari: {}"
#: webapp/models.py:234
#: webapp/models.py:242
msgid "Role"
msgstr "Rooli"
#: webapp/models.py:236
#: webapp/models.py:243
msgid "Roles"
msgstr "Roolit"
#: webapp/models.py:245
msgid "Start date"
msgstr "Alkupäivämäärä"
#: webapp/models.py:237
#: webapp/models.py:246
msgid "End date"
msgstr "Loppupäivämäärä"
#: webapp/models.py:247
#: webapp/models.py:256
msgid "Official"
msgstr "Toimihenkilö"
#: webapp/models.py:257
msgid "Officials"
msgstr "Toimihenkilöt"
#: webapp/models.py:285
msgid "Telegram channel"
msgstr "Telegram-kanava"
#: webapp/models.py:286
msgid "Telegram channels"
msgstr "Telegram-kanavat"
#: webapp/templates/admin_index.html:6
msgid "SIK Admin"
msgstr "SIK Hallintapaneeli"
@@ -785,10 +817,6 @@ msgstr "Kilta"
msgid "Jobs"
msgstr "Työpaikat"
#: webapp/templates/kaehmy.html:12
msgid "Kaehmylomake"
msgstr "Kaehmylomake"
#: webapp/templates/kaehmy.html:16
msgid ""
"Kaehmykoneella voit ilmaista kiinnostuksesi toimia killassa ensi vuonna.\n"
@@ -846,28 +874,32 @@ msgstr ""
msgid "Vaalikokous, osa 3 (toimarien valinta)"
msgstr ""
#: webapp/templates/kaehmy_list.html:24
#: webapp/templates/kaehmy_list.html:24 webapp/templates/kaehmy_list.html:59
msgid "All kaehmys"
msgstr "Kaikki kaehmyt"
#: webapp/templates/kaehmy_list.html:28
#: webapp/templates/kaehmy_list.html:32
msgid "Commenting on post by "
msgstr "Kommentoidaan viestiin lähettäjältä"
#: webapp/templates/kaehmy_list.html:44
msgid "Comment"
msgstr "Kommentti"
#: webapp/templates/kaehmy_list.html:57
msgid "Filter kaehmys"
msgstr "Rajaa kaehmyjä"
#: webapp/templates/kaehmy_list.html:70
#: webapp/templates/kaehmy_statistics.html:18
msgid "Total kaehmys:"
msgstr "Kaehmyjä yhteensä:"
#: webapp/templates/kaehmy_list.html:36
msgid "Commenting on post by "
msgstr "Kommentoidaan viestiin lähettäjältä"
#: webapp/templates/kaehmy_list.html:48
msgid "Comment"
msgstr "Kommentti"
#: webapp/templates/kaehmy_list.html:73
#: webapp/templates/kaehmy_list.html:88
msgid "Show comments"
msgstr "Näytä kommentit"
#: webapp/templates/kaehmy_list.html:79
#: webapp/templates/kaehmy_list.html:94
msgid "Add comment"
msgstr "Kommentoi"
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-10-18 07:17
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('webapp', '0033_telegramchannel_name'),
]
operations = [
migrations.AlterModelOptions(
name='kaehmyform',
options={'verbose_name': 'Kaehmylomake', 'verbose_name_plural': 'Kaehmylomakkeet'},
),
migrations.AlterModelOptions(
name='kaehmymessage',
options={'verbose_name': 'Kaehmykommentti', 'verbose_name_plural': 'Kaehmykommentit'},
),
migrations.AlterModelOptions(
name='telegramchannel',
options={'verbose_name': 'Telegram channel', 'verbose_name_plural': 'Telegram channels'},
),
migrations.RemoveField(
model_name='kaehmymessage',
name='timestamp',
),
migrations.AddField(
model_name='messageparent',
name='timestamp',
field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Timestamp'),
),
]
+15 -1
View File
@@ -143,6 +143,7 @@ class MessageParent(models.Model):
name = models.CharField(_('Name'), max_length=255, default='')
email = models.EmailField(_('Email'), default='')
timestamp = models.DateTimeField(_('Timestamp'), default=timezone.now)
def __str__(self):
return 'Message parent #{}'.format(self.id)
@@ -155,9 +156,12 @@ class KaehmyMessage(MessageParent):
Every message relates to certain kaehmyform or parent message.
"""
class Meta:
verbose_name = _('Kaehmykommentti')
verbose_name_plural = _('Kaehmykommentit')
message = models.TextField(_('Message'))
parent = models.ForeignKey('MessageParent', related_name='messages')
timestamp = models.DateTimeField(_('Timestamp'), default=timezone.now)
class KaehmyForm(MessageParent):
@@ -174,6 +178,10 @@ class KaehmyForm(MessageParent):
(5, 'N'),
)
class Meta:
verbose_name = _('Kaehmylomake')
verbose_name_plural = _('Kaehmylomakkeet')
phone_number = models.CharField(
_('Phone number'), max_length=10, default="")
year = models.IntegerField(_('Year'), choices=YEAR_CHOICES)
@@ -232,6 +240,7 @@ class Role(PresetRole):
"""Meta class for Role model."""
verbose_name = _('Role')
verbose_name_plural = _('Roles')
start_date = models.DateField(_('Start date'))
end_date = models.DateField(_('End date'))
@@ -245,6 +254,7 @@ class Official(User):
"""Meta class for Official class."""
verbose_name = _('Official')
verbose_name_plural = _('Officials')
phone_number = PhoneNumberField(_('Phone number'))
@@ -271,6 +281,10 @@ class OhlhafvChallenge(models.Model):
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)
+6
View File
@@ -17,4 +17,10 @@ div.tooltip-inner {
.tooltip {
margin-left: 1rem;
}
.role-filter-form {
max-width: 30rem;
width: auto;
margin-bottom: 1rem;
}
+20 -5
View File
@@ -24,10 +24,6 @@
<h2 style="padding-top: 1rem">{% trans "All kaehmys" %}</h2>
</div>
<div>
<h6 style="padding-bottom: 1rem">{% trans "Total kaehmys:" %} {{ application_count }}</h6>
</div>
<div class="collapse" id="collapse_add_comment">
<div class="card">
<div class="card-block">
@@ -56,6 +52,25 @@
</div>
</div>
<div>
<form class="role-filter-form form-inline" method="GET">
<label><strong>{% trans "Filter kaehmys" %}:</strong></label>
<select onchange="this.form.submit()" name="role" class="form-control">
<option value="-1">{% trans "All kaehmys" %}</option>
{% for option in filter_options %}
<option value={{ option.0 }} {% if request.GET.role|slugify == option.0|slugify %} selected="selected"{% endif %}>
{{ option.1 }} ({{ option.2 }})
</option>
{% endfor %}
</select>
</form>
</div>
<div>
<h6 style="padding-bottom: 1rem">{% trans "Total kaehmys:" %} {{ application_count }}</h6>
</div>
{% for application in applications %}
<div class="card">
<h4 class="card-header">{{ application.name }}</h4>
@@ -66,7 +81,7 @@
{% if application.official_roles|length > 0 %}
<h5 style="padding-bottom: 1rem" class="card-subtitle mb-2 text-muted">{{ application.official_roles }}</h5>
{% endif %}
<p class="card-text">{{ application.text }}</p>
<p class="card-text">{{ application.text|linebreaks }}</p>
{% if application.comment_count > 0 %}
<a type="button" style="cursor: pointer" data-toggle="collapse" data-target="#collapse_{{ application.id }}" aria-expanded="false" aria-controls="collapse_{{ application.id }}">
+12 -2
View File
@@ -1,5 +1,6 @@
"""Webapp views."""
from django.db.models import Count
from django.shortcuts import render, redirect
from django.contrib.auth import login, logout, authenticate
from django.views.decorators.http import require_http_methods
@@ -226,11 +227,20 @@ def ohlhafv_list(request, *args, **kwargs):
def kaehmy_list_view(request, *args, **kwargs):
"""Kaehmy application list"""
applications = KaehmyForm.objects.all()
role_filter = request.GET.get('role', None)
if role_filter is not None and str(role_filter) != '-1':
applications = KaehmyForm.objects.filter(custom_roles__id=role_filter) | KaehmyForm.objects.filter(preset_roles__id=role_filter)
else:
applications = KaehmyForm.objects.all()
applications = applications.order_by('-timestamp')
filter_options_preset = PresetKaehmyRole.objects.annotate(form_count=Count('forms')).filter(form_count__gt=0)
filter_options = [(r.id, r.name, r.form_count) for r in filter_options_preset]
context = {
'applications': applications,
'application_count': len(applications)
'application_count': len(applications),
'filter_options': filter_options
}
return render(request, 'kaehmy_list.html', context)