I have interesting experience with `value_list` and I don't know why is it acting in this way.

I want to update any value in `TestObject` has `value_1` to `value_2` and any value\_2 to value\_1. Where `value_1` and `value_2` from type Value and `TestObject` has a foreign key to Value.

This is my code:

```
def _swap(value_1, value_2):
    from_values_ids = TestObject.objects.filter(value=value_1).values_list('id', flat=True)

    to_values_ids = TestObject.objects.filter(value=value_2).values_list('id', flat=True)

    TestObject.objects.filter(id__in=from_values_ids).update(value=value_2)
    TestObject.objects.filter(id__in=to_values_ids).update(value=value_1)

```

I tested with TestObject has `value_1` but does not have any `value_2`.
The end result was nothing happened after running this function. After investigating I found the TestObject got updated to `value_2` after running:

```
TestObject.objects.filter(id__in=from_values_ids).update(value=value_2)

```

but it returned back after running 

```
TestObject.objects.filter(id__in=to_values_ids).update(value=value_1)

```

I thought may be `to_values_ids` has lazy load that is why I added `print to_values_id`.

```
def _swap(value_1, value_2):
    from_values_ids = TestObject.objects.filter(value=value_1).values_list('id', flat=True)

    to_values_ids = TestObject.objects.filter(value=value_2).values_list('id', flat=True)

    print to_values_ids

    TestObject.objects.filter(id__in=from_values_ids).update(value=value_2)
    TestObject.objects.filter(id__in=to_values_ids).update(value=value_1)

```

But I got the same result. Although my print for `to_values_ids` has `[]`.

The way I fix it I created new lists with the ids and it worked but still needs to understand the core python how is it work? Any good explanation.