﻿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
3480	sqlreset drops more tables than it should for GenericRelations to separate apps	rpuls@…	nobody	"A model from app A has a GenericRelation to another model in app B. When I reset app A, Django outputs DROP TABLE statements for the model from B. Example:

apps/test/models.py:

{{{
#!python
from django.db import models
from generictestcase.apps.meta.models import Tag

class Article(models.Model):
	tags = models.GenericRelation(Tag)
}}}

apps/meta/models.py:

{{{
#!python
from django.db import models
from django.contrib.contenttypes.models import ContentType

class Tag(models.Model):
	content_type = models.ForeignKey(ContentType)
	object_id = models.PositiveIntegerField()
	object = models.GenericForeignKey()
}}}

I use ""python manage.py syncdb"" to create the database tables (sqlite3 in my case), then ""python manage.py sqlreset '''test'''"" to generate SQL:

{{{
BEGIN;
DROP TABLE ""meta_tag"";
DROP TABLE ""test_article"";
CREATE TABLE ""test_article"" (
    ""id"" integer NOT NULL PRIMARY KEY
);
COMMIT;
}}}

Django shouldn't drop the ""meta_tag"" table here, because it lives in the ""meta"" app.
"		closed	Database layer (models, ORM)	dev		fixed			Accepted	1	0	1	0	0	0
