For any dictionary in a list, does a value exist for a key?

2011-04-18 Thread Chris Roat
Does a function or construct exist to easily do the following? my_list = [{'id': 'foo'}, {'id': 'bar', 'other': 'baz'}] {% is my_id_value in my_list.id %} // True if my_id_value is 'foo' or 'bar' Thanks! -- You received this message because you are subscribed to the Google Groups "Django u

Re: For any dictionary in a list, does a value exist for a key?

2011-04-19 Thread Chris Roat
Yep - trying to do it in a template. I can just do the logic within in python - it'll mean redundant info going into the template, but that's OK. Thanks for your response, C On Mon, Apr 18, 2011 at 9:27 AM, Shawn Milochik wrote: > You can do this pretty easily in Python with any(): > > if any