Monday, October 20, 2014

Re: Django builds incorrect sql-query

On Mon, Oct 20, 2014 at 3:43 AM, Алексей Широков <alexi1988@gmail.com> wrote:
> Javier, I am unable combine 2 parameters in a single call filter(), because
> It is built on different levels of code.
>
> Is there another solution???


you can build up a dictionary and expand as parameters on a single
filter() call:

params = {}
params['sendings__user']=1
......
params['sendings__state']=0b0000001
......
qs = Document.objects.filter(**params)

i think you can also use a Q() object, but i'm not so sure about the
exact 'simultaneity' behavior.

--
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/CAFkDaoTYGTkFNrM1Ncuw3OJQU5V_5pZ8zfAke0mB%3DUhZGvk_%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment