-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
template tags pollutes global context with 'object' #132
Comments
I'd assume that the snippet_fragment will not need access to the context, or will it? If not it can be solved by providing the template tag with its own context replacing djangocms-snippet/djangocms_snippet/templatetags/snippet_tags.py Lines 84 to 100 in b53f675
|
It may be the case that some people use it this way - the way I dont want/need it: using context from "outside", in the snippet, so changing this might breakt their projects.. ;-) Alternative solutions could be: Clone the context (not very efficient, probably!), or use a different name for the snippet object in the context ('snippet'?). I've not used djangocms-snippet before, so I'm no big help of how people use it. There is one closed issue, though, and how I can feel there, it should work as we two think. see #38 |
If this is a potential use case the solution probably involves "popping" the updated context after rendering the content:
Just one has to be aware that there are multiple updates. |
Yeah, that would do it! |
I had a hard time debugging a project where this library was used. The problem is, that the
{% snippet_fragment 'whatever' %}
overrides theobject
of the current context. This is not as it should be...in my case, introducing a snippet in a detail view caused the mainobject
of my detail view to change.cms 3.11.1 snippet 3.1.0 django 3.2.16
The text was updated successfully, but these errors were encountered: