Ajout de l'API pour Faun Auteurs
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage / context_processors.py
CommitLineData
9af73c99
AJ
1# -*- encoding: utf-8 -*-
2
bae03b7b 3import re
9af73c99 4
bae03b7b
EMS
5DISCIPLINE_REGION_RE = re.compile(r'/(discipline/(?P<discipline>\d+)/)?(region/(?P<region>\d+)/)?')
6def discipline_region(request):
7 match = DISCIPLINE_REGION_RE.match(request.path)
8 discipline = match.group('discipline')
9 region = match.group('region')
10 discipline = discipline and int(discipline)
11 region = region and int(region)
12 return dict(discipline_active=discipline, region_active=region)