Fix things

This commit is contained in:
Jan Tuomi
2017-10-12 00:56:28 +03:00
parent d6239139e0
commit e8fafeda84
12 changed files with 156 additions and 65 deletions
Binary file not shown.
+56 -24
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-11 22:47+0300\n" "POT-Creation-Date: 2017-10-12 00:48+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -168,7 +168,7 @@ msgid "id"
msgstr "id" msgstr "id"
#: infoscreen/templates/infoscreen_admin.html:141 webapp/models.py:93 #: infoscreen/templates/infoscreen_admin.html:141 webapp/models.py:93
#: webapp/models.py:123 webapp/templates/kaehmy_list.html:40 #: webapp/models.py:126 webapp/templates/kaehmy_list.html:40
msgid "Name" msgid "Name"
msgstr "Name" msgstr "Name"
@@ -210,7 +210,7 @@ msgstr "First name"
msgid "Last name" msgid "Last name"
msgstr "Last name" msgstr "Last name"
#: members/models.py:16 webapp/models.py:124 #: members/models.py:16 webapp/models.py:127
#: webapp/templates/kaehmy_list.html:44 #: webapp/templates/kaehmy_list.html:44
msgid "Email" msgid "Email"
msgstr "Email" msgstr "Email"
@@ -551,6 +551,18 @@ msgid "Copyright Aalto-yliopiston Sähköinsinöörikilta ry"
msgstr "Copyright Aalto-yliopiston Sähköinsinöörikilta ry" msgstr "Copyright Aalto-yliopiston Sähköinsinöörikilta ry"
#: webapp/forms.py:28 #: webapp/forms.py:28
#, fuzzy
#| msgid "Total challenges:"
msgid "Custom roles"
msgstr "Total challenges:"
#: webapp/forms.py:30
#, fuzzy
#| msgid "Total challenges:"
msgid "Preset roles"
msgstr "Total challenges:"
#: webapp/forms.py:40
msgid "Invalid value" msgid "Invalid value"
msgstr "" msgstr ""
@@ -610,71 +622,95 @@ msgstr "Rotation"
msgid "Registrations" msgid "Registrations"
msgstr "Rotations" msgstr "Rotations"
#: webapp/models.py:94 webapp/models.py:163 #: webapp/models.py:94 webapp/models.py:166
#, fuzzy #, fuzzy
#| msgid "Add member" #| msgid "Add member"
msgid "Board member" msgid "Board member"
msgstr "Add member" msgstr "Add member"
#: webapp/models.py:97 #: webapp/models.py:98
#, fuzzy #, fuzzy
#| msgid "Add member" #| msgid "Add member"
msgid "board member" msgid "board member"
msgstr "Add member" msgstr "Add member"
#: webapp/models.py:103 #: webapp/models.py:104
#, fuzzy #, fuzzy
#| msgid "Duration" #| msgid "Duration"
msgid "Description" msgid "Description"
msgstr "Duration" msgstr "Duration"
#: webapp/models.py:104 #: webapp/models.py:105
msgid "Summary" msgid "Summary"
msgstr "" msgstr ""
#: webapp/models.py:137 #: webapp/models.py:112
#, fuzzy
#| msgid "Total challenges:"
msgid "Preset kaehmy role"
msgstr "Total challenges:"
#: webapp/models.py:113
#, fuzzy
#| msgid "Total challenges:"
msgid "Preset kaehmy roles"
msgstr "Total challenges:"
#: webapp/models.py:120
#, fuzzy
#| msgid "Total challenges:"
msgid "Custom kaehmy role"
msgstr "Total challenges:"
#: webapp/models.py:121
#, fuzzy
#| msgid "Total challenges:"
msgid "Custom kaehmy roles"
msgstr "Total challenges:"
#: webapp/models.py:140
msgid "Message" msgid "Message"
msgstr "" msgstr ""
#: webapp/models.py:139 #: webapp/models.py:142
msgid "Timestamp" msgid "Timestamp"
msgstr "" msgstr ""
#: webapp/models.py:157 webapp/models.py:216 #: webapp/models.py:160 webapp/models.py:224
msgid "Phone number" msgid "Phone number"
msgstr "" msgstr ""
#: webapp/models.py:158 #: webapp/models.py:161
msgid "Year" msgid "Year"
msgstr "" msgstr ""
#: webapp/models.py:159 #: webapp/models.py:162
msgid "Text" msgid "Text"
msgstr "" msgstr ""
#: webapp/models.py:161 #: webapp/models.py:164
msgid "Custom role name" msgid "Custom role name"
msgstr "" msgstr ""
#: webapp/models.py:171 #: webapp/models.py:174
#, fuzzy #, fuzzy
#| msgid "Member applications" #| msgid "Member applications"
msgid "Kaehmy application: {}" msgid "Kaehmy application: {}"
msgstr "Member applications" msgstr "Member applications"
#: webapp/models.py:201 #: webapp/models.py:209
msgid "Role" msgid "Role"
msgstr "" msgstr ""
#: webapp/models.py:203 #: webapp/models.py:211
msgid "Start date" msgid "Start date"
msgstr "" msgstr ""
#: webapp/models.py:204 #: webapp/models.py:212
msgid "End date" msgid "End date"
msgstr "" msgstr ""
#: webapp/models.py:214 #: webapp/models.py:222
msgid "Official" msgid "Official"
msgstr "" msgstr ""
@@ -733,15 +769,11 @@ msgstr ""
msgid "Comment" msgid "Comment"
msgstr "" msgstr ""
#: webapp/templates/kaehmy_list.html:63 #: webapp/templates/kaehmy_list.html:69
msgid "Roles"
msgstr ""
#: webapp/templates/kaehmy_list.html:75
msgid "Show comments" msgid "Show comments"
msgstr "" msgstr ""
#: webapp/templates/kaehmy_list.html:81 #: webapp/templates/kaehmy_list.html:75
#, fuzzy #, fuzzy
#| msgid "Add payment" #| msgid "Add payment"
msgid "Add comment" msgid "Add comment"
Binary file not shown.
+47 -24
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-11 22:47+0300\n" "POT-Creation-Date: 2017-10-12 00:48+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -169,7 +169,7 @@ msgid "id"
msgstr "id" msgstr "id"
#: infoscreen/templates/infoscreen_admin.html:141 webapp/models.py:93 #: infoscreen/templates/infoscreen_admin.html:141 webapp/models.py:93
#: webapp/models.py:123 webapp/templates/kaehmy_list.html:40 #: webapp/models.py:126 webapp/templates/kaehmy_list.html:40
msgid "Name" msgid "Name"
msgstr "Nimi" msgstr "Nimi"
@@ -209,7 +209,7 @@ msgstr "Etunimi"
msgid "Last name" msgid "Last name"
msgstr "Sukunimi" msgstr "Sukunimi"
#: members/models.py:16 webapp/models.py:124 #: members/models.py:16 webapp/models.py:127
#: webapp/templates/kaehmy_list.html:44 #: webapp/templates/kaehmy_list.html:44
msgid "Email" msgid "Email"
msgstr "Sähköposti" msgstr "Sähköposti"
@@ -544,6 +544,14 @@ msgid "Copyright Aalto-yliopiston Sähköinsinöörikilta ry"
msgstr "Copyright Aalto-yliopiston Sähköinsinöörikilta ry" msgstr "Copyright Aalto-yliopiston Sähköinsinöörikilta ry"
#: webapp/forms.py:28 #: webapp/forms.py:28
msgid "Custom roles"
msgstr "Uudet virat"
#: webapp/forms.py:30
msgid "Preset roles"
msgstr "Kaehmyvirat"
#: webapp/forms.py:40
msgid "Invalid value" msgid "Invalid value"
msgstr "Epäkelpo arvo" msgstr "Epäkelpo arvo"
@@ -595,63 +603,79 @@ msgstr "Ilmoittautuminen"
msgid "Registrations" msgid "Registrations"
msgstr "Ilmoittautumiset" msgstr "Ilmoittautumiset"
#: webapp/models.py:94 webapp/models.py:163 #: webapp/models.py:94 webapp/models.py:166
msgid "Board member" msgid "Board member"
msgstr "Hallituksen jäsen" msgstr "Hallituksen jäsen"
#: webapp/models.py:97 #: webapp/models.py:98
msgid "board member" msgid "board member"
msgstr "Hallituksen jäsen" msgstr "Hallituksen jäsen"
#: webapp/models.py:103 #: webapp/models.py:104
msgid "Description" msgid "Description"
msgstr "Kuvaus" msgstr "Kuvaus"
#: webapp/models.py:104 #: webapp/models.py:105
msgid "Summary" msgid "Summary"
msgstr "Tiivistelmä" msgstr "Tiivistelmä"
#: webapp/models.py:137 #: webapp/models.py:112
msgid "Preset kaehmy role"
msgstr "Kaehmyvirka"
#: webapp/models.py:113
msgid "Preset kaehmy roles"
msgstr "Kaehmyvirat"
#: webapp/models.py:120
msgid "Custom kaehmy role"
msgstr "Uusi virka"
#: webapp/models.py:121
msgid "Custom kaehmy roles"
msgstr "Uudet kaehmyvirat"
#: webapp/models.py:140
msgid "Message" msgid "Message"
msgstr "Viesti" msgstr "Viesti"
#: webapp/models.py:139 #: webapp/models.py:142
msgid "Timestamp" msgid "Timestamp"
msgstr "Aikaleima" msgstr "Aikaleima"
#: webapp/models.py:157 webapp/models.py:216 #: webapp/models.py:160 webapp/models.py:224
msgid "Phone number" msgid "Phone number"
msgstr "Puhelinnumero" msgstr "Puhelinnumero"
#: webapp/models.py:158 #: webapp/models.py:161
msgid "Year" msgid "Year"
msgstr "Vuosi" msgstr "Vuosi"
#: webapp/models.py:159 #: webapp/models.py:162
msgid "Text" msgid "Text"
msgstr "Teksti" msgstr "Teksti"
#: webapp/models.py:161 #: webapp/models.py:164
msgid "Custom role name" msgid "Custom role name"
msgstr "Uusi virka" msgstr "Uusi virka"
#: webapp/models.py:171 #: webapp/models.py:174
msgid "Kaehmy application: {}" msgid "Kaehmy application: {}"
msgstr "Kaehmy: {}" msgstr "Kaehmy: {}"
#: webapp/models.py:201 #: webapp/models.py:209
msgid "Role" msgid "Role"
msgstr "Rooli" msgstr "Rooli"
#: webapp/models.py:203 #: webapp/models.py:211
msgid "Start date" msgid "Start date"
msgstr "Alkupäivämäärä" msgstr "Alkupäivämäärä"
#: webapp/models.py:204 #: webapp/models.py:212
msgid "End date" msgid "End date"
msgstr "Loppupäivämäärä" msgstr "Loppupäivämäärä"
#: webapp/models.py:214 #: webapp/models.py:222
msgid "Official" msgid "Official"
msgstr "Toimihenkilö" msgstr "Toimihenkilö"
@@ -708,15 +732,11 @@ msgstr "Kommentoidaan viestiin lähettäjältä"
msgid "Comment" msgid "Comment"
msgstr "Kommentti" msgstr "Kommentti"
#: webapp/templates/kaehmy_list.html:63 #: webapp/templates/kaehmy_list.html:69
msgid "Roles"
msgstr "Roolit"
#: webapp/templates/kaehmy_list.html:75
msgid "Show comments" msgid "Show comments"
msgstr "Näytä kommentit" msgstr "Näytä kommentit"
#: webapp/templates/kaehmy_list.html:81 #: webapp/templates/kaehmy_list.html:75
msgid "Add comment" msgid "Add comment"
msgstr "Kommentoi" msgstr "Kommentoi"
@@ -785,6 +805,9 @@ msgstr "Kaikki haasteet"
msgid "Total challenges:" msgid "Total challenges:"
msgstr "Haasteita yhteensä:" msgstr "Haasteita yhteensä:"
#~ msgid "Roles"
#~ msgstr "Roolit"
#~ msgid "Apply" #~ msgid "Apply"
#~ msgstr "Hakulomake" #~ msgstr "Hakulomake"
+8 -2
View File
@@ -21,12 +21,18 @@ class KaehmyForm_Form(forms.ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(KaehmyForm_Form, self).__init__(*args, **kwargs) super(KaehmyForm_Form, self).__init__(*args, **kwargs)
self.fields["custom_roles"].widget = forms.widgets.CheckboxSelectMultiple()
custom_roles_exist = CustomKaehmyRole.objects.all().exists()
self.fields["custom_roles"].widget = forms.widgets.CheckboxSelectMultiple() if custom_roles_exist else forms.HiddenInput()
self.fields["custom_roles"].help_text = "" self.fields["custom_roles"].help_text = ""
self.fields["custom_roles"].label = _('Custom roles')
self.fields["custom_roles"].queryset = CustomKaehmyRole.objects.all() self.fields["custom_roles"].queryset = CustomKaehmyRole.objects.all()
self.fields["preset_roles"].widget = forms.widgets.CheckboxSelectMultiple() self.fields["preset_roles"].widget = forms.widgets.CheckboxSelectMultiple(attrs={'title': _('Preset roles')})
self.fields["preset_roles"].help_text = "" self.fields["preset_roles"].help_text = ""
self.fields["preset_roles"].queryset = PresetKaehmyRole.objects.all() self.fields["preset_roles"].queryset = PresetKaehmyRole.objects.all()
self.fields["preset_roles"].label = _('Preset roles')
print(vars(self.fields["custom_roles"]))
def clean_phone_number(self): def clean_phone_number(self):
"""Clean phone number field.""" """Clean phone number field."""
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-10-11 21:37
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('webapp', '0026_auto_20171011_2236'),
]
operations = [
migrations.DeleteModel(
name='KaehmyFormSelectedRole',
),
migrations.AlterModelOptions(
name='customkaehmyrole',
options={'verbose_name': 'Custom kaehmy role', 'verbose_name_plural': 'Custom kaehmy roles'},
),
migrations.AlterModelOptions(
name='presetkaehmyrole',
options={'verbose_name': 'Preset kaehmy role', 'verbose_name_plural': 'Preset kaehmy roles'},
),
]
+8 -6
View File
@@ -107,16 +107,18 @@ class PresetRole(BaseRole):
class PresetKaehmyRole(PresetRole): class PresetKaehmyRole(PresetRole):
"""Model for kaehmy role.""" """Model for kaehmy role."""
pass
class Meta:
verbose_name = _('Preset kaehmy role')
verbose_name_plural = _('Preset kaehmy roles')
class CustomKaehmyRole(BaseRole): class CustomKaehmyRole(BaseRole):
"""Model representing a user-specified custom occupation.""" """Model representing a user-specified custom occupation."""
pass
class Meta:
verbose_name = _('Custom kaehmy role')
class KaehmyFormSelectedRole(models.Model): verbose_name_plural = _('Custom kaehmy roles')
pass
class MessageParent(models.Model): class MessageParent(models.Model):
+1 -1
View File
@@ -6,7 +6,7 @@
} }
body { body {
max-width: 700px; max-width: 1000px;
margin-left: auto !important; margin-left: auto !important;
margin-right: auto !important; margin-right: auto !important;
} }
+1 -1
View File
@@ -9,7 +9,7 @@
{% block content %} {% block content %}
<div> <div>
<h3>{% trans "Kaehmy" %}</h3> <h3 style="padding-top: 1rem">{% trans "Kaehmy" %}</h3>
<div id="input_form"> <div id="input_form">
<form name="kaehmyForm" action="/kaehmy/submit/" method="post" class="form">{% csrf_token %} <form name="kaehmyForm" action="/kaehmy/submit/" method="post" class="form">{% csrf_token %}
+1 -1
View File
@@ -1,7 +1,7 @@
{% load i18n %} {% load i18n %}
<link rel="stylesheet" href="/static/css/kaehmy_nav.css"> <link rel="stylesheet" href="/static/css/kaehmy_nav.css">
<div class="kaehmy_navigation"> <div class="kaehmy_navigation">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded"> <nav style="border-bottom: 2px solid #282b3b" class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#kaehmy_nav" aria-controls="kaehmy_nav" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#kaehmy_nav" aria-controls="kaehmy_nav" aria-expanded="false" aria-label="Toggle navigation">
Menu<span class="navbar-toggler-icon"></span> Menu<span class="navbar-toggler-icon"></span>
</button> </button>
+1 -1
View File
@@ -3,6 +3,6 @@
<div class="header-content"> <div class="header-content">
<div class="logo"> <div class="logo">
<a href="/"><img src="/static/img/logo_header.png" alt="Aalto-yliopiston Sähköinsinöörikilta ry"></a> <a href="/kaehmy"><img src="/static/img/logo_header.png" alt="Aalto-yliopiston Sähköinsinöörikilta ry"></a>
</div> </div>
</div> </div>
+7 -5
View File
@@ -139,10 +139,12 @@ def kaehmy_submit(request, *args, **kwargs):
application = form.save() application = form.save()
custom_name = form.cleaned_data.get('custom_role_name') custom_name = form.cleaned_data.get('custom_role_name')
custom_is_board = form.cleaned_data.get('custom_role_is_board') custom_is_board = form.cleaned_data.get('custom_role_is_board')
custom_role = CustomKaehmyRole(
name=custom_name, is_board=custom_is_board) if len(custom_name) > 0:
custom_role.save() custom_role = CustomKaehmyRole(
application.custom_roles.add(custom_role) name=custom_name, is_board=custom_is_board)
custom_role.save()
application.custom_roles.add(custom_role)
email = form.cleaned_data.get('email', '') email = form.cleaned_data.get('email', '')
name = form.cleaned_data.get('name', 'Anonymous') name = form.cleaned_data.get('name', 'Anonymous')
@@ -151,7 +153,7 @@ def kaehmy_submit(request, *args, **kwargs):
'Mahdollisista kommenteista tulee ilmoitus sähköpostitse.\r\n\r\n' 'Mahdollisista kommenteista tulee ilmoitus sähköpostitse.\r\n\r\n'
'Käy katsomassa kaehmytilanne osoitteessa http://sika.sahkoinsinoorikilta.fi/kaehmy').format(name) 'Käy katsomassa kaehmytilanne osoitteessa http://sika.sahkoinsinoorikilta.fi/kaehmy').format(name)
# 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))
else: else:
context = { context = {