Opened 2 years ago

Last modified 16 months ago

#19966 new New feature

Allow for silent or conditional loading of custom template tags

Reported by: anonymous Owned by: nobody
Component: Template system Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


In an effort to create a modular project I have included all custom tags / filters related to an app in that app's templatetags folder as instructed.

Should I ever want to use those tags in any general project templates (such as base templates or just any plain template which doesn't belong to that specific app) I must ensure that app is installed in the project settings. While I understand the need for the app to be installed for the tag to work I still want my project to remain modular and not break should I run {% load some_custom_tag_lib %} while the app is "turned-off".

It would be nice if there was some way to load the tag and use it silently (meaning it won't break if the app isn't loaded) or a way to condition the loading and usage of the tag if that app being installed while skipping it if the app isn't installed.

Change History (2)

comment:1 Changed 2 years ago by jacob

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Someday/Maybe

This is a good idea in theory, but without a practical suggestion (API, patch, etc.) there isn't much we can do to move it forward. Moving to "someday"; if someone comes up with a concrete proposal we can look at this again.

comment:2 Changed 16 months ago by aaugustin

This would also help for the common requirement of loading {% static %} from staticfiles when it's available, from Django's default tags when it isn't.

Note: See TracTickets for help on using tickets.
Back to Top