constants.py
1 |
|
2 |
If there is a discrepancy about a certain constant, this file is the definite |
3 |
point of reference. |
4 |
""" |
5 |
|
6 |
from django.utils.translation import ugettext_lazy as _ |
7 |
import datetime |
8 |
|
9 |
COLORS = { |
10 |
_("UHasselt default"): "E73B2B", |
11 |
_("Faculty of Sciences"): "0076BE", |
12 |
_("Faculty of Transportation Sciences"): "C0D633", |
13 |
_("Faculty of Architecture and Arts"): "F4802D", |
14 |
_("Faculty of Business Economics"): "00ACEE", |
15 |
_("Faculty of Medicine and Life Sciences"): "9C3591", |
16 |
_("Faculty of Engineering Technology"): "5BC4BA", |
17 |
_("Faculty of Law"): "E41F3A", |
18 |
} |
19 |
|
20 |
def current_academic_year(): |
21 |
""" Returns the current academic year. The year is determined as follows: |
22 |
- If today is before September 15 of the current year, the returned value |
23 |
is the current year - 1. |
24 |
- If today is after September 15 of the current year, but before January 1 |
25 |
of the next year, it returns the current year as is. |
26 |
""" |
27 |
today = datetime.datetime.now() |
28 |
switch = datetime.datetime(datetime.datetime.now().year, 9, 15) |
29 |
if today < switch: |
30 |
return today.year - 1 |
31 |
else: |
32 |
return today.year |
33 |