#3480: sqlreset drops more tables than it should for GenericRelations to 
separate
apps
---------------------------+------------------------------------------------
Reporter:  [EMAIL PROTECTED]  |       Owner:  adrian          
  Status:  new             |   Component:  Database wrapper
 Version:  SVN             |    Keywords:                  
   Stage:  Unreviewed      |   Has_patch:  0               
---------------------------+------------------------------------------------
 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.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3480>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to