Re: inclusion tag variable resolving
On ma, 2010-05-24 at 13:49 -0700, christian verkerk wrote: > i made an inclusion tag for making an image button of varying widths, > which i call through: > > {% make_button 'click me' item.get_absolute_url %} > > i then resolve the second param in context for the button link, > however i would like to be able to do something along the lines of: > > {% make_button 'click me' '/specific/url/with/{{foo}}' %} > > in specific cases. resolving that whole second string into context to > get something like '/specific/url/with/bar/' {% make_button 'click me' '/specific/url/with/%s' foo %} -- Dennis K. They've gone to plaid! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: inclusion tag variable resolving
Can you not simply pass foo: {% make_button 'click me' foo %} ... resolve it, and then use either its .get_absolute_url() or something other url, depending on what foo is? The inclusion tag's python code is far more equipped to deal with logic decisions, special cases, etc. than the template is. On May 24, 4:49 pm, christian verkerkwrote: > i made an inclusion tag for making an image button of varying widths, > which i call through: > > {% make_button 'click me' item.get_absolute_url %} > > i then resolve the second param in context for the button link, > however i would like to be able to do something along the lines of: > > {% make_button 'click me' '/specific/url/with/{{foo}}' %} > > in specific cases. resolving that whole second string into context to > get something like '/specific/url/with/bar/' > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
inclusion tag variable resolving
i made an inclusion tag for making an image button of varying widths, which i call through: {% make_button 'click me' item.get_absolute_url %} i then resolve the second param in context for the button link, however i would like to be able to do something along the lines of: {% make_button 'click me' '/specific/url/with/{{foo}}' %} in specific cases. resolving that whole second string into context to get something like '/specific/url/with/bar/' -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.