it's better Person.objects.filter(models.Q(first_name__startswith='mic'), models.Q(first_name__startswith='joh'))
(only one query...)
2012/8/1 Robin Pedersen <robinpeder@gmail.com>
On Monday, December 11, 2006 4:37:25 AM UTC+1, Rares Vernica wrote:Hi,What is a way to get the union of two QuerySets?
Something like:
In [6]: a = Person.objects.filter(first_name__startswith='mic')
In [7]: b = Person.objects.filter(first_name__startswith='joh')
In [8]: a + b
Thanks a lot,
Ray--
Try:
a | b
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ie69j4ewJNUJ.
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.
Alex Perez
alex.perez@bebabum.com
bebabum be successful
c/ Còrsega 301-303, Àtic 2
08008 Barcelona
http://www.bebabum.com
http://www.facebook.com/bebabum
http://twitter.com/bebabum
This message is intended exclusively for its addressee and may contain
information that is confidential and protected by professional privilege.
If you are not the intended recipient you are hereby notified that any
dissemination, copy or disclosure of this communication is strictly prohibited by law.
Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si no es vd. el destinatario indicado,
queda notificado que la utilización, divulgación y/o copia sin autorización
está prohibida en virtud de la legislación vigente.
Le informamos que los datos personales que facilite/ha facilitado pasarán a
formar parte de un fichero responsabilidad de bebabum, S.L. y que tiene
por finalidad gestionar las relaciones con usted.
Tiene derecho al acceso, rectificación cancelación y oposición en nuestra
oficina ubicada en c/ Còrsega 301-303, Àtic 2 de Barcelona o a la dirección de e-mail lopd@bebabum.com
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.
No comments:
Post a Comment