Saturday, September 28, 2013

Re: custom if tag

Hi Alagappan,

The assignment_tag worked perfectly for me !

Thanks!
Vibhu


On Tue, Sep 24, 2013 at 1:01 AM, Alagappan <ralagappan2006@gmail.com> wrote:
You can implement has_applied as a filter instead of a template tag. https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-filters
Haven't check it, but something like {% if user|has_applied_filter: opening %} should essentially work out for your case. 


Another alternative could be use of assignment tags. From documentation "This function works the same way as simple_tag, except that it stores the tag's result in a specified context variable instead of directly outputting it.". 

Regards,
Alagappan R

Twitter: @_alagappan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.



--
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment