django-templates-macros icon indicating copy to clipboard operation
django-templates-macros copied to clipboard

setmacro is broken by design

Open twidi opened this issue 10 years ago • 1 comments

When using usemacro, the context is updated with variables passed to the macro

A context variable with the name of the macro is created containing the result of the macro.

But setmacro do the same!!

So each call of usemacro or setmacro for the same macro will erase the previous context variable.

TODO:

  • [ ] make a copy of the context before updating it to pass it to the macro
  • [ ] stop saving the result of the macro in the context
  • [ ] make usemacro accept a as argument (as some django template tags), and remove setmacro

twidi avatar Oct 29 '15 21:10 twidi

PS: it was removed from the documentation in 0.3 (but still available in code)

twidi avatar Aug 16 '23 23:08 twidi