'Set up and execute an update query that clears related entries for the
keys in pk_list.
This is used by the QuerySet.delete_objects() method.'

def clear_related(self, related_field, pk_list, using):

    for offset in range(0, len(pk_list), GET_ITERATOR_CHUNK_SIZE):
        self.where = self.where_class()
        f = self.model._meta.pk
        self.where.add((Constraint(None, f.column, f), 'in', pk_list[offset:(offset + GET_ITERATOR_CHUNK_SIZE)]), AND)
        self.values = [(related_field, None, None)]
        self.get_compiler(using).execute_sql(None)
