title: How to do DB update in a single query in django when using an IF condition?
body: <p>I have the following code -</p>
  <pre><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')
  </code></pre>
  <p>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?</p>