title: Using existing field values in django update query
body: <p>I want to update a bunch of rows in a table to set the id = self.id. How would I do the below?</p>
  
  <pre><code>from metadataorder.tasks.models import Task
  tasks = Task.objects.filter(task_definition__cascades=False)
          .update(shared_task_id=self.id)
  </code></pre>
  
  <p>The equivalent SQL would be:</p>
  
  <pre><code>update tasks_task t join tasks_taskdefinition d
      on t.task_definition_id = d.id
  set t.shared_task_id = t.id
      where d.cascades = 0
  </code></pre>