I have the following custom inclusion tag:
from django.template import Library from django.db.models import Count register = Library() @register.inclusion_tag('projects/work_part.html', takes_context=True) def project_list(context): return {'projects':context['projects']}
My settings are as follows:
TEMPLATE_CONTEXT_PROCESSORS = ( 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'django.core.context_processors.media', 'context_processors.default_processors', )
I need to access MEDIA_URL in the work_path.html template, but the context processors don't seem to apply to custom templates.
How do I access MEDIA_URL in a template tag? I saw this post: Access STATIC_URL from a custom inclusion template tag , but I am not using STATIC_URL, is there another set of tags that need to be downloaded?
Hanpan
source share