﻿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
23673	IntegrityError when using a ManyToMany relation to add a model instance with unique constraint.	j_schn14	nobody	"Setting:
- two models connected with a m2m relation. (let's call them m1, m2 and the ralation m1.m2m)
- one of them has a unique relation on one field. (lets say field1)
- creating instances of m2 via m1.m2m.get_or_create works only once for every unique value of field1. independent of the instance of m1.

The get parts tries to get an instance of m2 which is related to m1, which does not exists. this leads to creating a new instance of m2 with field equals the value used above. this already exists and leads to a IntegrityError.

See this minimal example:
http://pastebin.com/eUs1R6fD"	Bug	closed	Database layer (models, ORM)	1.7	Normal	worksforme	ManyToManyField, get_or_create		Unreviewed	0	0	0	0	0	0
