Unverified Commit 1a4a89ef authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

Redirect menu board link to point to current board

parent 6ab9da8b
......@@ -14,4 +14,5 @@ urlpatterns = [
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$', views.current_board, name='current-board'),
]
from django.shortcuts import get_object_or_404, render
from django.shortcuts import get_object_or_404, render, redirect, reverse
from utils.translation import localize_attr_name
from .models import Board, Committee, CommitteeMembership
......@@ -62,3 +62,11 @@ def board_detail(request, id):
return render(request, 'activemembers/board_detail.html',
{'board': board,
'members': members})
def current_board(request):
try:
board = Board.objects.order_by('-since')[0]
except IndexError:
return redirect(reverse('activemembers:boards'))
return redirect(board.get_absolute_url())
......@@ -3,7 +3,7 @@ from django.utils.translation import ugettext_lazy as _
main = [
{'title': _('Home'), 'name': 'index'},
{'title': _('Association'), 'name': 'association', 'submenu': [
{'title': _('Board'), 'name': 'activemembers:board'},
{'title': _('Board'), 'name': 'activemembers:current-board'},
{'title': _('Committees'), 'name': 'activemembers:committees'},
{'title': _('Members'), 'name': 'members:index'},
{'title': _('Documents'), 'name': 'documents:index'},
......
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