Friday, May 27, 2011

Re: nested template tags

thanks for your help...

template tag:
@register.filter(name='get_page')
def get_page(var, name):
return u"%s=%d" % (name,var)

template:
{% with i|get_page:'page' as xxx %}
<a href="?{{ current_qstring|qstring_set:xxx }}">i</a>
{% endwith %}

yes, i was planning to use snippet at
http://djangosnippets.org/snippets/553/ for get parameters.

2011/5/26 Andreas Rammhold <andreas+django@rammhold.de>:
> Heya,
> I'm not 100% sure if this solves the problem for you (or if it's even
> intended to do what you want) but:
>
> {% with old_i=i %}
>    <a href="?{{ current_qstring|qstring_set:'page={{ old_i }}' }}">{{ i }}</a>
> {% endwith %}
>
> Haven't tried that yet but could be worth a shot.
>
> https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#with
>
>
> On Thu, May 26, 2011 at 9:08 AM, ozgur yilmaz <yelbuke@gmail.com> wrote:
>> Hi,
>>
>> I want to use an expression like this:
>>
>> <a href="?{{ current_qstring|qstring_set:'page={{ i }}' }}">{{ i }}</a>
>>
>> The first {{ i }} is in another tag. is there any way to manage this problem?
>>
>> Thanks,
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
>> For more options, visit this group at http://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-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://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-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment