diff --git a/webapp/migrations/0037_auto_20180301_2111.py b/webapp/migrations/0037_auto_20180301_2111.py new file mode 100644 index 0000000..b5cab47 --- /dev/null +++ b/webapp/migrations/0037_auto_20180301_2111.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2018-03-01 19:11 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('webapp', '0036_auto_20180301_2011'), + ] + + operations = [ + migrations.AlterModelOptions( + name='committee', + options={'verbose_name': 'Committee', 'verbose_name_plural': 'Committees'}, + ), + ] diff --git a/webapp/models.py b/webapp/models.py index 3010192..6f40f60 100644 --- a/webapp/models.py +++ b/webapp/models.py @@ -243,6 +243,15 @@ class Committee(models.Model): Has many Roles found under variable roles """ + class Meta: + """Meta class for Committee class.""" + + verbose_name = _('Committee') + verbose_name_plural = _('Committees') + + def __str__(self): + return _('Committee: {}').format(self.name) + name = models.CharField(max_length=255) diff --git a/webapp/static/css/contact.css b/webapp/static/css/contact.css new file mode 100644 index 0000000..d935e46 --- /dev/null +++ b/webapp/static/css/contact.css @@ -0,0 +1,6 @@ + +.role-container { + background-color: aqua; + width: 200px; + text-align: center; +} \ No newline at end of file diff --git a/webapp/templates/contact.html b/webapp/templates/contact.html index c400a99..bf51df3 100644 --- a/webapp/templates/contact.html +++ b/webapp/templates/contact.html @@ -4,55 +4,42 @@ {% load i18n %}
-
+ {% load static %}
+
+ {% trans "Contact" %}+ + {% if committee_list %} + + {% for com in committee_list %} + + +{{ com.committee.name }}+ + + {% if com.roles_list %} + {% for role in com.roles_list %} +
+
+
- |
-
- {{role}} - {{ role.official.first_name }} {{ rooli.official.last_name }} - {{ role.official.email }} - {{ role.official.phone_number }} - - |
-
Ei rooleja
- {% endif %} - - {% if all_committees %} - {% load static %} -{{committee.name}}
- {% if roles_list %} - {% for role in roles_list %} -{{role.name}}
- {% endfor %} - {% else %} -Ei ole rooleja tällä toimikunnalla
- {% endif %} - {% endfor %} - {% else%} -Ei Toimikuntia
- {% endif %} -{{role.official.first_name}} + {{role.official.last_name}} + {{role.official.email}}
+Ei Toimikuntia
+ {% endif %} {% endblock %} diff --git a/webapp/views.py b/webapp/views.py index 9107645..6112a36 100644 --- a/webapp/views.py +++ b/webapp/views.py @@ -145,8 +145,6 @@ def sosso_view(request, *args, **kwargs): def contact_view(request, *args, **kwargs): """Render "Contact" page.""" - # TODO - # # Lajitellaan roolit toimikunnittain # in format: context = { # committee_list: [ @@ -162,15 +160,14 @@ def contact_view(request, *args, **kwargs): # ]} # - #all_officials = Official.objects.all() all_roles = Role.objects.all() - all_committees = Committee.objects.all() + all_committees = Committee.objects.order_by('name') committee_list = [] for committee in all_committees: - committee_list.append({"committee":committee, "roles_list":committee.roles}) + committee_list.append({"committee":committee, "roles_list":committee.roles.all()}) - context = {"all_roles": all_roles, "all_committees": committee_list} + context = {"all_roles": all_roles, "committee_list": committee_list} return render(request, "contact.html", context)