Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- custom_templates.py
- from django import template
- register = template.Library()
- @register.filter
- def index(d, key):
- return d[key]
- settings.py
- TEMPLATES = [
- {
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [TEMPLATE_DIR],
- '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',
- ],
- 'libraries': 'app.templatetags.custom_templates',
- },
- },
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement