Re: Building filter strings dynamically

2008-05-13 Thread AndyB
I struggled to work this out and it's one of those problems that's hard to work out what you should Google for. It would make a worthy addition to the docs IMHO. On May 10, 4:08 am, Greg Fuller <[EMAIL PROTECTED]> wrote: > Thanks to both.  Got it working. > > On May 9, 9:17 pm, Aaron Fay <[EMAIL

Re: Building filter strings dynamically

2008-05-09 Thread Greg Fuller
Thanks to both. Got it working. On May 9, 9:17 pm, Aaron Fay <[EMAIL PROTECTED]> wrote: > Similarly, this will work also:field = 'sections' qry = > qry.filter(**{field+'__name__exact': 'shooting'})Cheers, > Aaron > John Lenton wrote:On Fri, May 9, 2008 at 6:19 PM, Greg Fuller<[EMAIL > PROTECTE

Re: Building filter strings dynamically

2008-05-09 Thread Aaron Fay
Similarly, this will work also: field = 'sections' qry = qry.filter(**{field+'__name__exact': 'shooting'}) Cheers, Aaron John Lenton wrote: On Fri, May 9, 2008 at 6:19 PM, Greg Fuller <[EMAIL PROTECTED]> wrote: Hello, I'm trying to build filter strings dynamically. The norma

Re: Building filter strings dynamically

2008-05-09 Thread John Lenton
On Fri, May 9, 2008 at 6:19 PM, Greg Fuller <[EMAIL PROTECTED]> wrote: > > Hello, > > I'm trying to build filter strings dynamically. > > The normal way works: >qry = qry.filter(sections__name__exact='printing') > > This does not work: >filter_str = "sections__name__exact='shooting'" >

Building filter strings dynamically

2008-05-09 Thread Greg Fuller
Hello, I'm trying to build filter strings dynamically. The normal way works: qry = qry.filter(sections__name__exact='printing') This does not work: filter_str = "sections__name__exact='shooting'" qry = qry.filter(filter_str) . The error is "too many values to unpack" at django/db/mo