I have the following code -
testcase = Table1.objects.filter(ID=id,serialno ='1234', condition='False').exists()
if not testcase:
c = Table1.objects.filter(ID=id,serialno ='1234').select_for_update().update(condition='True')
Here, I am querying the same DB twice. Is there any way where I can do the filter exists and update in a single query?