{% if folder.id in private_folder_details.values() %} should do the trick

On Fri, Sep 7, 2012 at 11:06 AM, Jason <1jason.whatf...@gmail.com> wrote:

> Hi there,
>
> I'm using django 1.2 and am attempting to get the following code to work.
>
> private_folder_details = [{"folderId":"1111", "name": "The folder
> name"},{"folderId":"1221", "name": "The other folder name"}]
> private_folders = [{"id":"1111"},{"id":"2222"}]
>
> {% for folder in private_folders %}
> *    {% if folder.id in private_folder_details %}*
>         <input type="checkbox" name="syncCheckbox" id="{{folder.id}}"
> checked="yes" value="{{folder.id}}">
>     {% else %}
>         <input type="checkbox" name="syncCheckbox" id="{{folder.id}}"
>  value="{{folder.id}}">
>     {% endif %}
> {% endfor %}
>
> Essentially if folder.id is within any of the private_folder_details
> folderId's then I want the checkbox to be checked. What I'm doing above
> doesn't seem to work though - any idea how it could be made to work?
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/6wVcQQxDg_sJ.
> To post to this group, send email to django-users@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.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to