Monday, January 24, 2011

Re: Cant find out the "OR" in query

On 24 January 2011 07:18, nicolas lubkov <nlubkov@gmail.com> wrote:
> hi all is pretty simple my question.
> when im making a query in django i use this
> result = person.objects.filter(name = "nick", lastname = "smith")
>
> this is like "select * from person where name = 'nick' and lastname = 'smith
> i cant figure it out how to make
>   "select * from person where name = 'nick' OR lastname = 'smith


You want to use the Q object

http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects

cheers,
Konrad

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate