Template tags and filters from app in COMMON_EXTRA_APPS no longer available
Hello,
I have a custom app installed in COMMON_EXTRA_APPS
, which makes custom template tags and filters available through a file in its templatetags
subdirectory. This used to work in earlier versions of Mayan (3.4.9), but has stopped working with 4.4.2. I believe the cause is the creation of a custom django Engine in apps/templating/classes.py, which results in djangos usual loading mechanism for template tags from apps being circumvented.
The reason for the custom Engine seems to be to make the new mayan math filters / template tags available through the builtins
argument. I would suggest using the builtins
option of the django.template.backends.django.DjangoTemplates
instead: https://docs.djangoproject.com/en/3.2/topics/templates/#module-django.template.backends.django (scroll down)
This could be added in settings/base.py to the OPTIONS
like so:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'OPTIONS': {
'builtins': [
'mathfilters.templatetags.mathfilters',
'mayan.apps.templating.templatetags.templating_tags'
],
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages'
],
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader'
]
}
}
]
I have not tested this yet, since I don't have a proper development environment right now.