﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
19816	Assigning a QS to a M2M relation that was generated from that M2M relation clears both the QS and the relation	jedediah	Aleksandra Sendecka	"{{{
from django.db import models

class Topping(models.Model):
    meat = models.BooleanField()

class Pizza(models.Model):
    toppings = models.ManyToManyField(Topping)
}}}
{{{
>>> pizza = Pizza.objects.create()
>>> cheese = Topping.objects.create(meat=False)
>>> bacon = Topping.objects.create(meat=True)
>>> pizza.toppings = [cheese, bacon]
>>> pizza.toppings.count()
2
>>> vegs = pizza.toppings.filter(meat=False)
>>> vegs.count()
1
>>> pizza.toppings = vegs
>>> pizza.toppings.count()
0
>>> vegs.count()
0
}}}

Would expect vegs to be unchanged, and pizza.toppings to be [cheese]

The problem is the same if the vegs QS is generated with Topping.objects.filter(pizza=pizza). If it comes from somewhere not involving the relation then everything works as expected."	Bug	closed	Database layer (models, ORM)	1.4	Normal	fixed	sprint2013		Ready for checkin	1	0	0	0	0	0
