Skip to content

Instantly share code, notes, and snippets.

@maxtortime
Last active August 13, 2018 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxtortime/0abbc5b76033db2a23f20df1a859754b to your computer and use it in GitHub Desktop.
Save maxtortime/0abbc5b76033db2a23f20df1a859754b to your computer and use it in GitHub Desktop.
navbar 만들기
# context_processors.py
def menus(request):
return {
'menus': [
{'path': reverse(path), 'name': name,
'active': 'active' if request.get_full_path() == reverse(
path) else ''}
for path, name in
(
('drug_sim', 'CONCEPT SETS'), ('biomarker', 'BIOMARKER'),
('cohorts', 'STUDY DESIGN'),
('characteristics', 'CHARACTERISTICS'),
('distribution', 'DISTRIBUTION'), ('adr', 'ADR PROFILE'),
('trial', 'TRIAL SIMULATION')
)
]
}
# settings.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')]
,
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'AI_CTS.settings.context_processors.menus'
],
},
},
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment