﻿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
21278	Using dumpdata to create unit test fixtures causes duplicate foreign keys for auth permissions.  Excluding auth causes other referenced auth models to be missing.	ellisd23@…	nobody	"This seems to be a pretty fundamental issue, since models will frequently reference User.  There are many instances of users having frustrations with contrib apps that are auto-generated upon migration/sync (e.g. [http://stackoverflow.com/questions/853796/problems-with-contenttypes-when-loading-a-fixture-in-django contenttypes]).

For contenttypes, this issue can be mitigated by excluding the app and using --natural.  But for contrib.auth, if the app is excluded, any referenced User objects in fixture data will be missing.  If the app is not excluded, duplicate permissions will be created, since the post-migration signal will have already created them.  Since there is a unique key restraint, the importing of the fixture data will fail.  It's a catch 22.

Developers can manually remove the permissions from the fixture data, or override fixture loading in their tests to remove the data, but it seems to me that since this is such a basic piece of functionality, there should be a simple interface to do such a thing.  It'd be nice to have something simpler for contenttypes as well, rather than ""--exclude contenttypes --natural""."	New feature	new	contrib.auth	1.5	Normal				Accepted	0	0	0	0	0	0
