Verified Commit 08bccd98 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Add option to have contact email address as string next to mailing list

parent 2d34b6fd
...@@ -36,7 +36,8 @@ class CommitteeAdmin(TranslatedModelAdmin): ...@@ -36,7 +36,8 @@ class CommitteeAdmin(TranslatedModelAdmin):
filter_horizontal = ('permissions',) filter_horizontal = ('permissions',)
fields = ('name', 'description', 'photo', 'permissions', 'since', fields = ('name', 'description', 'photo', 'permissions', 'since',
'until', 'contact_mailinglist', 'wiki_namespace', 'active') 'until', 'contact_mailinglist', 'contact_email',
'wiki_namespace', 'active')
def get_queryset(self, request): def get_queryset(self, request):
qs = super().get_queryset(request) qs = super().get_queryset(request)
...@@ -49,8 +50,8 @@ class BoardAdmin(TranslatedModelAdmin): ...@@ -49,8 +50,8 @@ class BoardAdmin(TranslatedModelAdmin):
exclude = ('is_board',) exclude = ('is_board',)
filter_horizontal = ('permissions',) filter_horizontal = ('permissions',)
fields = ('name', 'photo', 'permissions', fields = ('name', 'photo', 'permissions', 'contact_mailinglist',
'since', 'until',) 'contact_email', 'since', 'until',)
@admin.register(models.CommitteeMembership) @admin.register(models.CommitteeMembership)
......
...@@ -7,170 +7,185 @@ msgid "" ...@@ -7,170 +7,185 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-13 21:12+0100\n" "POT-Creation-Date: 2017-07-05 19:09+0200\n"
"PO-Revision-Date: 2017-01-30 18:54+0100\n" "PO-Revision-Date: 2017-08-17 11:41+0200\n"
"Last-Translator: Joost Rijneveld <joost@joostrijneveld.nl>\n" "Last-Translator: Sébastiaan Versteeg <se_bastiaan@outlook.com>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: nl\n" "Language: nl\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.8.11\n" "X-Generator: Poedit 2.0.3\n"
#: models.py:53 #: models.py:55
msgid "Committee name" msgid "Committee name"
msgstr "Commissienaam" msgstr "Commissienaam"
#: models.py:59 #: models.py:61
msgid "Description" msgid "Description"
msgstr "Beschrijving" msgstr "Beschrijving"
#: models.py:63 #: models.py:65
msgid "Image" msgid "Image"
msgstr "Afbeelding" msgstr "Afbeelding"
#: models.py:76 #: models.py:78
msgid "permissions" msgid "permissions"
msgstr "permissies" msgstr "permissies"
#: models.py:81 #: models.py:83
msgid "founded in" msgid "founded in"
msgstr "opgericht in" msgstr "opgericht in"
#: models.py:87 #: models.py:89
msgid "existed until" msgid "existed until"
msgstr "bestond tot" msgstr "bestond tot"
#: models.py:94 #: models.py:97
msgid "contact email address" msgid "contact email address"
msgstr "contact e-mailadres" msgstr "contact e-mailadres"
#: models.py:97 #: models.py:104
msgid "contact mailing list"
msgstr "contact mailinglijst"
#: models.py:110
msgid "Wiki namespace" msgid "Wiki namespace"
msgstr "Wiki namespace" msgstr "Wiki namespace"
#: models.py:109 #: models.py:121 models.py:124
msgid "Please use either the mailing list or email address option."
msgstr "Selecteer een mailinglijst óf vul een e-mailadres in."
#: models.py:135
msgid "committee" msgid "committee"
msgstr "commissie" msgstr "commissie"
#: models.py:110 templates/activemembers/committee_index.html:6 #: models.py:136 templates/activemembers/committee_index.html:7
msgid "committees" msgid "committees"
msgstr "commissies" msgstr "commissies"
#: models.py:131 #: models.py:157
msgid "Is this a board" msgid "Is this a board"
msgstr "Is dit een bestuur" msgstr "Is dit een bestuur"
#: models.py:149 models.py:150 #: models.py:164
msgid "Access the board wiki"
msgstr ""
#: models.py:190 models.py:191
msgid "A board already exists for those years" msgid "A board already exists for those years"
msgstr "Er bestaat al een bestuur voor die jaren" msgstr "Er bestaat al een bestuur voor die jaren"
#: models.py:167 models.py:299 #: models.py:209 models.py:342
msgid "Member" msgid "Member"
msgstr "Lid" msgstr "Lid"
#: models.py:173 #: models.py:215
msgid "Committee" msgid "Committee"
msgstr "Commissie" msgstr "Commissie"
#: models.py:177 #: models.py:219
msgid "Committee member since" msgid "Committee member since"
msgstr "Commissielid sinds" msgstr "Commissielid sinds"
#: models.py:178 #: models.py:220
msgid "The date this member joined the committee in this role" msgid "The date this member joined the committee in this role"
msgstr "De datum waarop deze persoon lid werd deze commissie in deze rol" msgstr "De datum waarop deze persoon lid werd deze commissie in deze rol"
#: models.py:183 #: models.py:225
msgid "Committee member until" msgid "Committee member until"
msgstr "Commissielid tot" msgstr "Commissielid tot"
#: models.py:184 #: models.py:226
msgid "A member of this committee until this time (can't be in the future)." msgid "A member of this committee until this time (can't be in the future)."
msgstr "" msgstr ""
"De datum waarop deze persoon de commissie verliet (kan niet in de toekomst " "De datum waarop deze persoon de commissie verliet (kan niet in de toekomst "
"liggen)" "liggen)"
#: models.py:191 #: models.py:233
msgid "Chair of the committee" msgid "Chair of the committee"
msgstr "Voorzitter van de commissie" msgstr "Voorzitter van de commissie"
#: models.py:192 #: models.py:234
msgid "There can only be one chair at a time!" msgid "There can only be one chair at a time!"
msgstr "Er kan maar één voorzitter tegelijkertijd zijn!" msgstr "Er kan maar één voorzitter tegelijkertijd zijn!"
#: models.py:198 #: models.py:240
msgid "role" msgid "role"
msgstr "rol" msgstr "rol"
#: models.py:199 #: models.py:241
msgid "The role of this member" msgid "The role of this member"
msgstr "De rol van dit lid binnen de commissie" msgstr "De rol van dit lid binnen de commissie"
#: models.py:225 #: models.py:267
msgid "End date can't be before start date" msgid "End date can't be before start date"
msgstr "De einddatum kan niet voor de startdatum liggen" msgstr "De einddatum kan niet voor de startdatum liggen"
#: models.py:228 #: models.py:270
msgid "End date can't be in the future" msgid "End date can't be in the future"
msgstr "De einddatum kan niet in de toekomst liggen" msgstr "De einddatum kan niet in de toekomst liggen"
#: models.py:232 #: models.py:274
msgid "End date cannot be set for boards" msgid "End date cannot be set for boards"
msgstr "Voor besturen kan geen einddatum worden opgegeven" msgstr "Voor besturen kan geen einddatum worden opgegeven"
#: models.py:255 #: models.py:298
msgid "There already is a chair for this time period" msgid "There already is a chair for this time period"
msgstr "Er is al een voorzitter voor deze periode" msgstr "Er is al een voorzitter voor deze periode"
#: models.py:271 #: models.py:314
msgid "This member is already in the committee for this period" msgid "This member is already in the committee for this period"
msgstr "Deze persoon is al lid van deze commissie in de aangegeven periode" msgstr "Deze persoon is al lid van deze commissie in de aangegeven periode"
#: models.py:291 #: models.py:334
msgid "committee membership" msgid "committee membership"
msgstr "commissielidmaatschap" msgstr "commissielidmaatschap"
#: models.py:292 #: models.py:335
msgid "committee memberships" msgid "committee memberships"
msgstr "commissielidmaatschappen" msgstr "commissielidmaatschappen"
#: models.py:304 #: models.py:347
#, python-brace-format #, python-brace-format
msgid "{name} mentor in {year}" msgid "{name} mentor in {year}"
msgstr "{name} mentor in {year}" msgstr "{name} mentor in {year}"
#: templates/activemembers/board_detail.html:4 #: templates/activemembers/board_detail.html:4
#: templates/activemembers/board_detail.html:8 #: templates/activemembers/board_detail.html:5
#: templates/activemembers/board_index.html:45 #: templates/activemembers/board_detail.html:9
#: templates/activemembers/board_index.html:50 #: templates/activemembers/board_index.html:46
#: templates/activemembers/board_index.html:51
msgid "Board" msgid "Board"
msgstr "Bestuur" msgstr "Bestuur"
#: templates/activemembers/board_detail.html:4 #: templates/activemembers/board_detail.html:4
#: templates/activemembers/board_detail.html:5
#: templates/activemembers/board_index.html:3 #: templates/activemembers/board_index.html:3
#: templates/activemembers/board_index.html:4
msgid "Boards" msgid "Boards"
msgstr "Besturen" msgstr "Besturen"
#: templates/activemembers/board_detail.html:26 #: templates/activemembers/board_detail.html:27
msgid "Board members" msgid "Board members"
msgstr "Bestuursleden" msgstr "Bestuursleden"
#: templates/activemembers/board_detail.html:42 #: templates/activemembers/board_detail.html:43
#: templates/activemembers/committee_detail.html:44 #: templates/activemembers/committee_detail.html:45
msgid "Chair" msgid "Chair"
msgstr "Voorzitter" msgstr "Voorzitter"
#: templates/activemembers/board_detail.html:59 #: templates/activemembers/board_detail.html:60
msgid "This board doesn't have any members?" msgid "This board doesn't have any members?"
msgstr "Dit bestuur heeft geen leden?" msgstr "Dit bestuur heeft geen leden?"
#: templates/activemembers/board_index.html:6 #: templates/activemembers/board_index.html:7
msgid "The board" msgid "The board"
msgstr "Het bestuur" msgstr "Het bestuur"
#: templates/activemembers/board_index.html:9 #: templates/activemembers/board_index.html:10
msgid "" msgid ""
"Thalia's board makes sure all operations during the academic year are taken " "Thalia's board makes sure all operations during the academic year are taken "
"care of, in front or behind the scenes. If you have any questions then you " "care of, in front or behind the scenes. If you have any questions then you "
...@@ -183,48 +198,50 @@ msgstr "" ...@@ -183,48 +198,50 @@ msgstr ""
"schermen. Bij vragen en opmerkingen kun je ze altijd persoonlijk aanspreken " "schermen. Bij vragen en opmerkingen kun je ze altijd persoonlijk aanspreken "
"of <a href=\"mailto:info@thalia.nu\">mailen</a>." "of <a href=\"mailto:info@thalia.nu\">mailen</a>."
#: templates/activemembers/board_index.html:27 #: templates/activemembers/board_index.html:28
msgid "Old boards" msgid "Old boards"
msgstr "Oude besturen" msgstr "Oude besturen"
#: templates/activemembers/board_index.html:37 #: templates/activemembers/board_index.html:38
#: templates/activemembers/committee_detail.html:18 #: templates/activemembers/committee_detail.html:19
#: templates/activemembers/committee_detail.html:20 #: templates/activemembers/committee_detail.html:21
#, python-format #, python-format
msgid "Photo of %(name)s" msgid "Photo of %(name)s"
msgstr "Foto van %(name)s" msgstr "Foto van %(name)s"
#: templates/activemembers/board_index.html:57 #: templates/activemembers/board_index.html:58
msgid "There are no boards!" msgid "There are no boards!"
msgstr "Er zijn geen besturen!" msgstr "Er zijn geen besturen!"
#: templates/activemembers/committee_detail.html:3 #: templates/activemembers/committee_detail.html:3
#: templates/activemembers/committee_detail.html:4
#: templates/activemembers/committee_index.html:3 #: templates/activemembers/committee_index.html:3
#: templates/activemembers/committee_index.html:4
msgid "Committees" msgid "Committees"
msgstr "Commissies" msgstr "Commissies"
#: templates/activemembers/committee_detail.html:24 #: templates/activemembers/committee_detail.html:25
#, python-format #, python-format
msgid "About the %(name)s" msgid "About the %(name)s"
msgstr "Over de %(name)s" msgstr "Over de %(name)s"
#: templates/activemembers/committee_detail.html:28 #: templates/activemembers/committee_detail.html:29
msgid "Committee members" msgid "Committee members"
msgstr "Commissieleden" msgstr "Commissieleden"
#: templates/activemembers/committee_detail.html:53 #: templates/activemembers/committee_detail.html:54
msgid "Committee member since: ?" msgid "Committee member since: ?"
msgstr "Commissielid sinds: ?" msgstr "Commissielid sinds: ?"
#: templates/activemembers/committee_detail.html:55 #: templates/activemembers/committee_detail.html:56
#, python-format #, python-format
msgid "Committee member since: %(since)s" msgid "Committee member since: %(since)s"
msgstr "Commissielid sinds: %(since)s" msgstr "Commissielid sinds: %(since)s"
#: templates/activemembers/committee_detail.html:67 #: templates/activemembers/committee_detail.html:68
msgid "This committee doesn't have any members?" msgid "This committee doesn't have any members?"
msgstr "Deze commissie heeft geen leden?" msgstr "Deze commissie heeft geen leden?"
#: templates/activemembers/committee_index.html:39 #: templates/activemembers/committee_index.html:40
msgid "There are no committees!" msgid "There are no committees!"
msgstr "Er zijn geen commissies!" msgstr "Er zijn geen commissies!"
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-19 20:25 # Generated by Django 1.11 on 2017-07-05 16:59
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
...@@ -14,13 +14,9 @@ class Migration(migrations.Migration): ...@@ -14,13 +14,9 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RemoveField(
model_name='committee',
name='contact_email',
),
migrations.AddField( migrations.AddField(
model_name='committee', model_name='committee',
name='contact_mailinglist', name='contact_mailinglist',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='mailinglists.MailingList', verbose_name='contact email address'), field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='mailinglists.MailingList', verbose_name='contact mailing list'),
), ),
] ]
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-07-05 17:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('activemembers', '0020_committee_contact_mailinglist'),
]
operations = [
migrations.AlterField(
model_name='committee',
name='contact_email',
field=models.EmailField(blank=True, max_length=254, null=True, verbose_name='contact email address'),
),
]
...@@ -17,6 +17,7 @@ logger = logging.getLogger(__name__) ...@@ -17,6 +17,7 @@ logger = logging.getLogger(__name__)
class UnfilteredSortedManager(models.Manager): class UnfilteredSortedManager(models.Manager):
"""Returns committees and boards, sorted by name""" """Returns committees and boards, sorted by name"""
def get_queryset(self): def get_queryset(self):
return (super().get_queryset() return (super().get_queryset()
.order_by(localize_attr_name('name'))) .order_by(localize_attr_name('name')))
...@@ -24,6 +25,7 @@ class UnfilteredSortedManager(models.Manager): ...@@ -24,6 +25,7 @@ class UnfilteredSortedManager(models.Manager):
class CommitteeManager(models.Manager): class CommitteeManager(models.Manager):
"""Returns committees only""" """Returns committees only"""
def get_queryset(self): def get_queryset(self):
return (super().get_queryset() return (super().get_queryset()
.exclude(board__is_board=True) .exclude(board__is_board=True)
...@@ -32,6 +34,7 @@ class CommitteeManager(models.Manager): ...@@ -32,6 +34,7 @@ class CommitteeManager(models.Manager):
class ActiveCommitteeManager(models.Manager): class ActiveCommitteeManager(models.Manager):
"""Returns active committees only""" """Returns active committees only"""
def get_queryset(self): def get_queryset(self):
return (super().get_queryset() return (super().get_queryset()
.exclude(board__is_board=True) .exclude(board__is_board=True)
...@@ -90,9 +93,15 @@ class Committee(models.Model, metaclass=ModelTranslateMeta): ...@@ -90,9 +93,15 @@ class Committee(models.Model, metaclass=ModelTranslateMeta):
active = models.BooleanField(default=False) active = models.BooleanField(default=False)
contact_email = models.EmailField(
_('contact email address'),
blank=True,
null=True,
)
contact_mailinglist = models.OneToOneField( contact_mailinglist = models.OneToOneField(
'mailinglists.MailingList', 'mailinglists.MailingList',
verbose_name=_('contact email address'), verbose_name=_('contact mailing list'),
null=True, null=True,
blank=True, blank=True,
) )
...@@ -103,6 +112,21 @@ class Committee(models.Model, metaclass=ModelTranslateMeta): ...@@ -103,6 +112,21 @@ class Committee(models.Model, metaclass=ModelTranslateMeta):
blank=True, blank=True,
max_length=50) max_length=50)
def clean(self):
"""Validation"""
if ((self.contact_email is not None and
self.contact_mailinglist is not None) or
(self.contact_email is None and
self.contact_mailinglist is None)):
raise ValidationError({
'contact_email':
_("Please use either the mailing list "
"or email address option."),
'contact_mailinglist':
_("Please use either the mailing list "
"or email address option.")
})
def __str__(self): def __str__(self):
return self.name return self.name
...@@ -119,8 +143,8 @@ class BoardManager(models.Manager): ...@@ -119,8 +143,8 @@ class BoardManager(models.Manager):
def get_queryset(self): def get_queryset(self):
# sorting by descending order by default makes more sense for boards # sorting by descending order by default makes more sense for boards
return (super().get_queryset() return (super().get_queryset()
.filter(is_board=True) .filter(is_board=True)
.order_by(localize_attr_name('-name'))) .order_by(localize_attr_name('-name')))
class Board(Committee): class Board(Committee):
...@@ -160,10 +184,10 @@ class Board(Committee): ...@@ -160,10 +184,10 @@ class Board(Committee):
continue continue
if ((board.until is None and ( if ((board.until is None and (
self.until is None or self.until >= board.since)) or self.until is None or self.until >= board.since)) or
(self.until is None and self.since <= board.until) or (self.until is None and self.since <= board.until) or
(self.until and board.until and (self.until and board.until and
self.since <= board.until and self.since <= board.until and
self.until >= board.since)): self.until >= board.since)):
raise ValidationError({ raise ValidationError({
'since': _('A board already exists for those years'), 'since': _('A board already exists for those years'),
'until': _('A board already exists for those years')}) 'until': _('A board already exists for those years')})
...@@ -171,6 +195,7 @@ class Board(Committee): ...@@ -171,6 +195,7 @@ class Board(Committee):
class ActiveMembershipManager(models.Manager): class ActiveMembershipManager(models.Manager):