Friday, April 10, 2015

Re: Help with the following query please

On Fri, Apr 10, 2015 at 11:39 AM, Bryan Arguello <bromero314@gmail.com> wrote:
> list = MyObject.objects.filter(field1 = entries1, field2 = entries2)

you can construct a dictionary and expand into function arguments:

list = MyObject.objects.filter(**{ f: e for f,e in (
('field1', entries1),
('field2', entries2),
.....)
if e is not None})


--
Javier

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFkDaoTv%2BeFfZJQKmtEX60BXSJDGaNuNPFkfHGUDd0L_xdeEdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment