Unverified Commit 8ed14ec2 authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

Prevent board memberships from ever expiring

parent c11a27da
......@@ -7,9 +7,9 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-05 16:36+0100\n"
"PO-Revision-Date: 2016-12-05 16:31+0100\n"
"Last-Translator: Sébastiaan Versteeg <se_bastiaan@outlook.com>\n"
"POT-Creation-Date: 2017-01-14 16:30+0100\n"
"PO-Revision-Date: 2017-01-14 16:31+0100\n"
"Last-Translator: Joost Rijneveld <joost@joostrijneveld.nl>\n"
"Language-Team: \n"
"Language: nl\n"
"MIME-Version: 1.0\n"
......@@ -58,85 +58,80 @@ msgstr "commissie"
msgid "committees"
msgstr "commissies"
#: models.py:112
#: models.py:117
msgid "Is this a board"
msgstr "Is dit een bestuur"
#: models.py:137 models.py:252
#: models.py:142 models.py:257
msgid "Member"
msgstr "Lid"
#: models.py:143
#: models.py:148
msgid "Committee"
msgstr "Commissie"
#: models.py:147
#: models.py:152
msgid "Committee member since"
msgstr "Commissielid sinds"
#: models.py:148
#: models.py:153
msgid "The date this member joined the committee in this role"
msgstr "De datum waarop deze persoon lid werd deze commissie in deze rol"
#: models.py:153
#: models.py:158
msgid "Committee member until"
msgstr "Commissielid tot"
#: models.py:154
#: models.py:159
msgid "A member of this committee until this time (can't be in the future)."
msgstr ""
"De datum waarop deze persoon de commissie verliet (kan niet in de toekomst "
"liggen)"
#: models.py:161
#: models.py:166
msgid "Chair of the committee"
msgstr "Voorzitter van de commissie"
#: models.py:162
#: models.py:167
msgid "There can only be one chair at a time!"
msgstr "Er kan maar één voorzitter tegelijkertijd zijn!"
#: models.py:168
#: models.py:173
msgid "role"
msgstr "rol"
#: models.py:169
#: models.py:174
msgid "The role of this member"
msgstr "De rol van dit lid binnen de commissie"
#: models.py:184
msgid "Membership expiration date can't be in the future: '{}'"
msgstr "Een lidmaatschap kan niet verlopen in de toekomst: '{}'"
#: models.py:190
#: models.py:189
msgid "End date can't be before start date"
msgstr "De einddatum kan niet voor de startdatum liggen"
#: models.py:204
#: models.py:192
msgid "End date cannot be set for boards"
msgstr "Voor besturen kan geen einddatum worden opgegeven"
#: models.py:213
msgid "There already is a chair for this time period"
msgstr "Er is al een voorzitter voor deze periode"
#: models.py:221
msgid "This member is already in the committee"
msgstr "Deze persoon is al lid van deze commissie"
#: models.py:224
#: models.py:229
msgid "This member is already in the committee for this period"
msgstr "Deze persoon is al lid van deze commissie in de aangegeven periode"
#: models.py:244
#: models.py:249
msgid "committee membership"
msgstr "commissielidmaatschap"
#: models.py:245
#: models.py:250
msgid "committee memberships"
msgstr "commissielidmaatschappen"
#: models.py:257
#, fuzzy, python-brace-format
#| msgid "Mentor introduction {year}"
#: models.py:262
#, python-brace-format
msgid "{name} mentor in {year}"
msgstr "Mentor introductie {year}"
msgstr "{name} mentor in {year}"
#: templates/activemembers/board_detail.html:4
#: templates/activemembers/board_detail.html:8
......@@ -215,5 +210,11 @@ msgstr "Deze commissie heeft geen leden?"
msgid "There are no committees!"
msgstr "Er zijn geen commissies!"
#~ msgid "Membership expiration date can't be in the future: '{}'"
#~ msgstr "Een lidmaatschap kan niet verlopen in de toekomst: '{}'"
#~ msgid "This member is already in the committee"
#~ msgstr "Deze persoon is al lid van deze commissie"
#~ msgid "Mentors {year}-{year_to}"
#~ msgstr "Mentoren {year}-{year_to}"
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-13 21:36
from __future__ import unicode_literals
from django.db import migrations, models
def remove_enddates(apps, schema_editor):
Board = apps.get_model("activemembers", "Board")
CommitteeMembership = apps.get_model("activemembers", "CommitteeMembership")
for board in Board.objects.all():
for membership in CommitteeMembership.objects.filter(committee=board):
membership.until = None
membership.save()
class Migration(migrations.Migration):
dependencies = [
('activemembers', '0014_committee_active'),
]
operations = [
migrations.RunPython(remove_enddates)
]
......@@ -106,6 +106,11 @@ class BoardManager(models.Manager):
class Board(Committee):
""" Because Board inherits from Committee, Django creates a OneToOneField
linking the two models together. This can be accessed as usual;
given a Committee or Board b, one can access b.board, which will either
return the object b if b is a Board, or a Board.DoesNotExist exception.
"""
objects = BoardManager()
is_board = models.BooleanField(
......@@ -182,6 +187,12 @@ class CommitteeMembership(models.Model, metaclass=ModelTranslateMeta):
if self.until and (not self.since or self.until < self.since):
raise ValidationError(
{'until': _("End date can't be before start date")})
try:
if self.until and self.committee.board:
raise ValidationError(
{'until': _("End date cannot be set for boards")})
except Board.DoesNotExist:
pass
def validate_unique(self, *args, **kwargs):
""" Check uniqueness"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment