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 ""
"Project-Id-Version: PACKAGE VERSION\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"
"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:93
#: webapp/models.py:123 webapp/templates/kaehmy_list.html:40
#: webapp/models.py:126 webapp/templates/kaehmy_list.html:40
msgid "Name"
msgstr "Name"
@@ -210,7 +210,7 @@ msgstr "First name"
msgid "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
msgid "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"
#: 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"
msgstr ""
@@ -610,71 +622,95 @@ msgstr "Rotation"
msgid "Registrations"
msgstr "Rotations"
#: webapp/models.py:94 webapp/models.py:163
#: webapp/models.py:94 webapp/models.py:166
#, fuzzy
#| msgid "Add member"
msgid "Board member"
msgstr "Add member"
#: webapp/models.py:97
#: webapp/models.py:98
#, fuzzy
#| msgid "Add member"
msgid "board member"
msgstr "Add member"
#: webapp/models.py:103
#: webapp/models.py:104
#, fuzzy
#| msgid "Duration"
msgid "Description"
msgstr "Duration"
#: webapp/models.py:104
#: webapp/models.py:105
msgid "Summary"
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"
msgstr ""
#: webapp/models.py:139
#: webapp/models.py:142
msgid "Timestamp"
msgstr ""
#: webapp/models.py:157 webapp/models.py:216
#: webapp/models.py:160 webapp/models.py:224
msgid "Phone number"
msgstr ""
#: webapp/models.py:158
#: webapp/models.py:161
msgid "Year"
msgstr ""
#: webapp/models.py:159
#: webapp/models.py:162
msgid "Text"
msgstr ""
#: webapp/models.py:161
#: webapp/models.py:164
msgid "Custom role name"
msgstr ""
#: webapp/models.py:171
#: webapp/models.py:174
#, fuzzy
#| msgid "Member applications"
msgid "Kaehmy application: {}"
msgstr "Member applications"
#: webapp/models.py:201
#: webapp/models.py:209
msgid "Role"
msgstr ""
#: webapp/models.py:203
#: webapp/models.py:211
msgid "Start date"
msgstr ""
#: webapp/models.py:204
#: webapp/models.py:212
msgid "End date"
msgstr ""
#: webapp/models.py:214
#: webapp/models.py:222
msgid "Official"
msgstr ""
@@ -733,15 +769,11 @@ msgstr ""
msgid "Comment"
msgstr ""
#: webapp/templates/kaehmy_list.html:63
msgid "Roles"
msgstr ""
#: webapp/templates/kaehmy_list.html:75
#: webapp/templates/kaehmy_list.html:69
msgid "Show comments"
msgstr ""
#: webapp/templates/kaehmy_list.html:81
#: webapp/templates/kaehmy_list.html:75
#, fuzzy
#| msgid "Add payment"
msgid "Add comment"
Binary file not shown.
+47 -24
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"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:93
#: webapp/models.py:123 webapp/templates/kaehmy_list.html:40
#: webapp/models.py:126 webapp/templates/kaehmy_list.html:40
msgid "Name"
msgstr "Nimi"
@@ -209,7 +209,7 @@ msgstr "Etunimi"
msgid "Last name"
msgstr "Sukunimi"
#: members/models.py:16 webapp/models.py:124
#: members/models.py:16 webapp/models.py:127
#: webapp/templates/kaehmy_list.html:44
msgid "Email"
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"
#: 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"
msgstr "Epäkelpo arvo"
@@ -595,63 +603,79 @@ msgstr "Ilmoittautuminen"
msgid "Registrations"
msgstr "Ilmoittautumiset"
#: webapp/models.py:94 webapp/models.py:163
#: webapp/models.py:94 webapp/models.py:166
msgid "Board member"
msgstr "Hallituksen jäsen"
#: webapp/models.py:97
#: webapp/models.py:98
msgid "board member"
msgstr "Hallituksen jäsen"
#: webapp/models.py:103
#: webapp/models.py:104
msgid "Description"
msgstr "Kuvaus"
#: webapp/models.py:104
#: webapp/models.py:105
msgid "Summary"
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"
msgstr "Viesti"
#: webapp/models.py:139
#: webapp/models.py:142
msgid "Timestamp"
msgstr "Aikaleima"
#: webapp/models.py:157 webapp/models.py:216
#: webapp/models.py:160 webapp/models.py:224
msgid "Phone number"
msgstr "Puhelinnumero"
#: webapp/models.py:158
#: webapp/models.py:161
msgid "Year"
msgstr "Vuosi"
#: webapp/models.py:159
#: webapp/models.py:162
msgid "Text"
msgstr "Teksti"
#: webapp/models.py:161
#: webapp/models.py:164
msgid "Custom role name"
msgstr "Uusi virka"
#: webapp/models.py:171
#: webapp/models.py:174
msgid "Kaehmy application: {}"
msgstr "Kaehmy: {}"
#: webapp/models.py:201
#: webapp/models.py:209
msgid "Role"
msgstr "Rooli"
#: webapp/models.py:203
#: webapp/models.py:211
msgid "Start date"
msgstr "Alkupäivämäärä"
#: webapp/models.py:204
#: webapp/models.py:212
msgid "End date"
msgstr "Loppupäivämäärä"
#: webapp/models.py:214
#: webapp/models.py:222
msgid "Official"
msgstr "Toimihenkilö"
@@ -708,15 +732,11 @@ msgstr "Kommentoidaan viestiin lähettäjältä"
msgid "Comment"
msgstr "Kommentti"
#: webapp/templates/kaehmy_list.html:63
msgid "Roles"
msgstr "Roolit"
#: webapp/templates/kaehmy_list.html:75
#: webapp/templates/kaehmy_list.html:69
msgid "Show comments"
msgstr "Näytä kommentit"
#: webapp/templates/kaehmy_list.html:81
#: webapp/templates/kaehmy_list.html:75
msgid "Add comment"
msgstr "Kommentoi"
@@ -785,6 +805,9 @@ msgstr "Kaikki haasteet"
msgid "Total challenges:"
msgstr "Haasteita yhteensä:"
#~ msgid "Roles"
#~ msgstr "Roolit"
#~ msgid "Apply"
#~ msgstr "Hakulomake"
+8 -2
View File
@@ -21,12 +21,18 @@ class KaehmyForm_Form(forms.ModelForm):
def __init__(self, *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"].label = _('Custom roles')
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"].queryset = PresetKaehmyRole.objects.all()
self.fields["preset_roles"].label = _('Preset roles')
print(vars(self.fields["custom_roles"]))
def clean_phone_number(self):
"""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):
"""Model for kaehmy role."""
pass
class Meta:
verbose_name = _('Preset kaehmy role')
verbose_name_plural = _('Preset kaehmy roles')
class CustomKaehmyRole(BaseRole):
"""Model representing a user-specified custom occupation."""
pass
class KaehmyFormSelectedRole(models.Model):
pass
class Meta:
verbose_name = _('Custom kaehmy role')
verbose_name_plural = _('Custom kaehmy roles')
class MessageParent(models.Model):
+1 -1
View File
@@ -6,7 +6,7 @@
}
body {
max-width: 700px;
max-width: 1000px;
margin-left: auto !important;
margin-right: auto !important;
}
+1 -1
View File
@@ -9,7 +9,7 @@
{% block content %}
<div>
<h3>{% trans "Kaehmy" %}</h3>
<h3 style="padding-top: 1rem">{% trans "Kaehmy" %}</h3>
<div id="input_form">
<form name="kaehmyForm" action="/kaehmy/submit/" method="post" class="form">{% csrf_token %}
+1 -1
View File
@@ -1,7 +1,7 @@
{% load i18n %}
<link rel="stylesheet" href="/static/css/kaehmy_nav.css">
<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">
Menu<span class="navbar-toggler-icon"></span>
</button>
+1 -1
View File
@@ -3,6 +3,6 @@
<div class="header-content">
<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>
+7 -5
View File
@@ -139,10 +139,12 @@ def kaehmy_submit(request, *args, **kwargs):
application = form.save()
custom_name = form.cleaned_data.get('custom_role_name')
custom_is_board = form.cleaned_data.get('custom_role_is_board')
custom_role = CustomKaehmyRole(
name=custom_name, is_board=custom_is_board)
custom_role.save()
application.custom_roles.add(custom_role)
if len(custom_name) > 0:
custom_role = CustomKaehmyRole(
name=custom_name, is_board=custom_is_board)
custom_role.save()
application.custom_roles.add(custom_role)
email = form.cleaned_data.get('email', '')
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'
'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))
else:
context = {