Skip to content

Context modifiers: Search for context_modifiers.py in registered Django apps #147

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

ababic
Copy link
Contributor

@ababic ababic commented May 28, 2021

As reported by @thibaudcolas on #141 - context modifiers registered in pattern_contexts.py (as indicated in docs) are not being picked up, because nothing is currently loading those modules.

I quite like the idea of using pattern_contexts.py as a pattern in apps, so these changes trigger a search for such modules when get_for_template() is first used (as late as possible, to avoid 'app not yet loaded' issues)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have added an appropriate CHANGELOG entry

@ababic ababic force-pushed the feature/search-for-context-modifiers branch from 74e1c6c to 1f1f556 Compare May 28, 2021 14:51
@ababic ababic requested a review from thibaudcolas May 28, 2021 14:53
@ababic ababic force-pushed the feature/search-for-context-modifiers branch from 1f1f556 to 30b50c2 Compare May 28, 2021 15:04
Copy link
Member

@thibaudcolas thibaudcolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank yoouuuuuuuuuuuuuuuuuuuuu

yay

@thibaudcolas thibaudcolas merged commit 509e16d into torchbox:master May 28, 2021
@thibaudcolas thibaudcolas added django Related to Django templates capabilities enhancement New feature or request labels May 28, 2021
@thibaudcolas thibaudcolas added this to the Nice to have milestone May 28, 2021
@ababic ababic deleted the feature/search-for-context-modifiers branch May 28, 2021 16:47
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
django Related to Django templates capabilities enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants