Django Queryset for Multiple set

17 views
Skip to first unread message

Vaibhav Mishra

unread,
Mar 13, 2019, 11:44:31 AM3/13/19
to Django users
Hi All,

I am trying to achieve below ,

variable = object.filter(clientname =cname , clienttype='windows' and clienttype='unix', errorcode='20')



 Notice that I want to filter by two or more values in second parameter.. How can we do this ?

Krishnasagar Subhedarpage

unread,
Mar 13, 2019, 11:48:06 AM3/13/19
to django...@googlegroups.com
You could do using django ORM query expressions. Refer below link:


Regards,
Krishnasagar Subhedarpage



--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/54464687-7fd0-4103-b74f-5de566ae9e89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chetan Ganji

unread,
Mar 13, 2019, 11:52:42 AM3/13/19
to django...@googlegroups.com
Hi Vaibhav, 

I think this would do what you want. Make sure too call the objects on the model name (  Modelname  ) ;-)  


systems = ['windows', 'unix']
variable = Modelname.objects.filter(clientname=cname, clienttype__in=systems, errorcode='20')



Regards,
Chetan Ganji
+91-900-483-4183


Reply all
Reply to author
Forward
0 new messages