Piyush S. Wanare
Piyush S. Wanare

Reputation: 4933

Django ORM Filter By Checking Both column contains same values

I have a model contains 3 column as follows:

Id NoOfL2 Open Delete Inprogress
1    2      1     1      0
2    4      1     2      1
3    3      3     0      0

I want to fetch all rows contains NoOfL2 == Open.

How should I found it using Django ORM?

Upvotes: 0

Views: 388

Answers (1)

jpic
jpic

Reputation: 33420

You should use F expressions:

Foo.objects.filter(NoOfL2=F('Open'))

Upvotes: 1

Related Questions