Unverified Commit b28cb05d authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

Use years in board urls rather than primary keys

parent 1a4a89ef
......@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-14 16:30+0100\n"
"PO-Revision-Date: 2017-01-14 16:31+0100\n"
"POT-Creation-Date: 2017-01-24 21:36+0100\n"
"PO-Revision-Date: 2017-01-24 21:36+0100\n"
"Last-Translator: Joost Rijneveld <joost@joostrijneveld.nl>\n"
"Language-Team: \n"
"Language: nl\n"
......@@ -18,117 +18,121 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.8.11\n"
#: models.py:43
#: models.py:53
msgid "Committee name"
msgstr "Commissienaam"
#: models.py:49
#: models.py:59
msgid "Description"
msgstr "Beschrijving"
#: models.py:53
#: models.py:63
msgid "Image"
msgstr "Afbeelding"
#: models.py:66
#: models.py:76
msgid "permissions"
msgstr "permissies"
#: models.py:71
#: models.py:81
msgid "founded in"
msgstr "opgericht in"
#: models.py:77
#: models.py:87
msgid "existed until"
msgstr "bestond tot"
#: models.py:84
#: models.py:94
msgid "contact email address"
msgstr "contact e-mailadres"
#: models.py:87
#: models.py:97
msgid "Wiki namespace"
msgstr "Wiki namespace"
#: models.py:99
#: models.py:109
msgid "committee"
msgstr "commissie"
#: models.py:100 templates/activemembers/committee_index.html:6
#: models.py:110 templates/activemembers/committee_index.html:6
msgid "committees"
msgstr "commissies"
#: models.py:117
#: models.py:131
msgid "Is this a board"
msgstr "Is dit een bestuur"
#: models.py:142 models.py:257
#: models.py:149 models.py:150
msgid "A board already exists for those years"
msgstr "Er bestaat al een bestuur voor die jaren"
#: models.py:167 models.py:296
msgid "Member"
msgstr "Lid"
#: models.py:148
#: models.py:173
msgid "Committee"
msgstr "Commissie"
#: models.py:152
#: models.py:177
msgid "Committee member since"
msgstr "Commissielid sinds"
#: models.py:153
#: models.py:178
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:158
#: models.py:183
msgid "Committee member until"
msgstr "Commissielid tot"
#: models.py:159
#: models.py:184
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:166
#: models.py:191
msgid "Chair of the committee"
msgstr "Voorzitter van de commissie"
#: models.py:167
#: models.py:192
msgid "There can only be one chair at a time!"
msgstr "Er kan maar één voorzitter tegelijkertijd zijn!"
#: models.py:173
#: models.py:198
msgid "role"
msgstr "rol"
#: models.py:174
#: models.py:199
msgid "The role of this member"
msgstr "De rol van dit lid binnen de commissie"
#: models.py:189
#: models.py:225
msgid "End date can't be before start date"
msgstr "De einddatum kan niet voor de startdatum liggen"
#: models.py:192
#: models.py:229
msgid "End date cannot be set for boards"
msgstr "Voor besturen kan geen einddatum worden opgegeven"
#: models.py:213
#: models.py:252
msgid "There already is a chair for this time period"
msgstr "Er is al een voorzitter voor deze periode"
#: models.py:229
#: models.py:268
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:249
#: models.py:288
msgid "committee membership"
msgstr "commissielidmaatschap"
#: models.py:250
#: models.py:289
msgid "committee memberships"
msgstr "commissielidmaatschappen"
#: models.py:262
#: models.py:301
#, python-brace-format
msgid "{name} mentor in {year}"
msgstr "{name} mentor in {year}"
......
......@@ -136,7 +136,18 @@ class Board(Committee):
ordering = ['-since']
def get_absolute_url(self):
return reverse('activemembers:board', args=[str(self.pk)])
return reverse('activemembers:board',
args=['{}-{}'.format(self.since.year, self.until.year)])
def validate_unique(self, *args, **kwargs):
""" Check uniqueness"""
super().validate_unique(*args, **kwargs)
for board in Board.objects.filter(since__year=self.since.year,
until__year=self.until.year):
if board is not self:
raise ValidationError({
'since': _('A board already exists for those years'),
'until': _('A board already exists for those years')})
class ActiveMembershipManager(models.Manager):
......
......@@ -13,6 +13,6 @@ urlpatterns = [
url(r'committees/$', views.committee_index, name='committees'),
url(r'^committees/(?P<id>\d+)/$', views.committee_detail, name='committee'),
url(r'^boards/$', views.board_index, name='boards'),
url(r'^boards/(?P<id>\d+)?$', views.board_detail, name='board'),
url(r'^board/(?P<year>\d{4}-\d{4})$', views.board_detail, name='board'),
url(r'^board$', views.current_board, name='current-board'),
]
......@@ -44,9 +44,10 @@ def board_index(request):
{'boards': boards})
def board_detail(request, id):
def board_detail(request, year):
"""View the details of a board"""
board = get_object_or_404(Board, pk=id)
since, until = year.split('-')
board = get_object_or_404(Board, since__year=since, until__year=until)
members = []
memberships = (CommitteeMembership
.objects
......
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