added config.py
This commit is contained in:
3
TimeDispatcher/config.py
Normal file
3
TimeDispatcher/config.py
Normal file
@ -0,0 +1,3 @@
|
||||
class Config:
|
||||
# Number of hours in an off-day
|
||||
WORKING_HOURS_PER_OFF_DAY = 8.2
|
27
TimeDispatcher/context_processors.py
Normal file
27
TimeDispatcher/context_processors.py
Normal file
@ -0,0 +1,27 @@
|
||||
from TimeDispatcher.config import Config
|
||||
from TimeDispatcher.settings import APP_VERSION, DEBUG
|
||||
|
||||
|
||||
def version(request):
|
||||
return {
|
||||
"debug": DEBUG,
|
||||
"version": APP_VERSION
|
||||
}
|
||||
|
||||
def navbar_links(request):
|
||||
return {
|
||||
"nav_links": [
|
||||
{'view': 'dashboard', 'label': 'Dashboard'},
|
||||
{'view': 'table', 'label': 'Table'},
|
||||
{'view': 'projects', 'label': 'Projects'},
|
||||
{'view': 'parents', 'label': 'Parents'},
|
||||
{'view': 'import', 'label': 'Import'},
|
||||
]
|
||||
}
|
||||
|
||||
def app_config(request):
|
||||
return {
|
||||
"config": {
|
||||
"WORKING_HOURS_PER_OFF_DAY": Config.WORKING_HOURS_PER_OFF_DAY
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
APP_VERSION = "0.1.0"
|
||||
|
||||
load_dotenv(BASE_DIR / ".env")
|
||||
load_dotenv(BASE_DIR / ".env", override=True)
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
||||
@ -68,8 +68,9 @@ TEMPLATES = [
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'context_processors.version',
|
||||
'context_processors.navbar_links'
|
||||
'TimeDispatcher.context_processors.app_config',
|
||||
'TimeDispatcher.context_processors.version',
|
||||
'TimeDispatcher.context_processors.navbar_links'
|
||||
],
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user