def pre_sql_setup(self):
    '\n        If the update depends on results from other tables, we need to do some\n        munging of the "where" conditions to match the format required for\n        (portable) SQL updates. That is done here.\n\n        Further, if we are going to be running multiple updates, we pull out\n        the id values to update at this point so that they don\'t change as a\n        result of the progressive updates.\n        '
    refcounts_before = self.query.alias_refcount.copy()
    self.query.get_initial_alias()
    count = self.query.count_active_tables()
    if ((not self.query.related_updates) and (count == 1)):
        return
    query = self.query.clone(klass=Query)
    query.select_related = False
    query.clear_ordering(True)
    query._extra = {}
    query.select = []
    query.add_fields([query.get_meta().pk.name])
    super(SQLUpdateCompiler, self).pre_sql_setup()
    must_pre_select = ((count > 1) and (not self.connection.features.update_can_self_select))
    self.query.where = self.query.where_class()
    if (self.query.related_updates or must_pre_select):
        idents = []
        for rows in query.get_compiler(self.using).execute_sql(MULTI):
            idents.extend((r[0] for r in rows))
        self.query.add_filter(('pk__in', idents))
        self.query.related_ids = idents
    else:
        self.query.add_filter(('pk__in', query))
    self.query.reset_refcounts(refcounts_before)
If the update depends on results from other tables, we need to do some
munging of the "where" conditions to match the format required for
(portable) SQL updates. That is done here.

Further, if we are going to be running multiple updates, we pull out
the id values to update at this point so that they don't change as a
result of the progressive updates.
def pre_sql_setup(self):
    '\n        If the update depends on results from other tables, we need to do some\n        munging of the "where" conditions to match the format required for\n        (portable) SQL updates. That is done here.\n\n        Further, if we are going to be running multiple updates, we pull out\n        the id values to update at this point so that they don\'t change as a\n        result of the progressive updates.\n        '
    refcounts_before = self.query.alias_refcount.copy()
    self.query.get_initial_alias()
    count = self.query.count_active_tables()
    if ((not self.query.related_updates) and (count == 1)):
        return
    query = self.query.clone(klass=Query)
    query.select_related = False
    query.clear_ordering(True)
    query._extra = {}
    query.select = []
    query.add_fields([query.get_meta().pk.name])
    super(SQLUpdateCompiler, self).pre_sql_setup()
    must_pre_select = ((count > 1) and (not self.connection.features.update_can_self_select))
    self.query.where = self.query.where_class()
    if (self.query.related_updates or must_pre_select):
        idents = []
        for rows in query.get_compiler(self.using).execute_sql(MULTI):
            idents.extend((r[0] for r in rows))
        self.query.add_filter(('pk__in', idents))
        self.query.related_ids = idents
    else:
        self.query.add_filter(('pk__in', query))
    self.query.reset_refcounts(refcounts_before)