Hi Guys,

I'm trying to do a hash lookup with two arrays. Basically, I have a
friends list and another list that has user id's. I want to check if
any of the user id's I have are also in the friends list.

The two arrays are just normal dictionaries that look something like
this:

friends = [id=1,id=2,id=3]
friends2 = [id=3]

I'm passing both of those arrays into my template file and then using
a templatetag to do the check:

-- TEMPLATETAG:

@register.filter
def IN(value,arg): return value in arg

-- TEMPLATE:

{% for people in friends %}
        {% if people.id|IN:friends2 %}
                {{ people.id }}
        {% else %}
                Not in list
        {% endif %}
{% endfor %}

This just prints out Not in list three times, any idea what I might be
doing wrong here?

Cheers,
Chris
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to