#29387: GenericRelation's on proxy models do not cascade deletion
-----------------------------------------+------------------------
               Reporter:  Mehmet Dogan   |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  2.0
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 For this code (from [https://stackoverflow.com/questions/33093281/django-
 generic-relations-not-working this StackOverflow question] ):
 {{{
 class Person(models.Model):
     identity = models.CharField(max_length=13, verbose_name="ID")
     name = models.CharField(max_length=255, verbose_name="Name")
     board = GenericRelation('second_app.BoardMember') #Second Try

     def __unicode__(self):
         return self.identity

     class Meta:
         verbose_name = "Person"
         verbose_name_plural = "People"

 class Student(Person):
     class Meta:
         proxy = True

 class Parent(Person):
     class Meta:
         proxy = True

 class Teacher(Person):
     board = GenericRelation('second_app.BoardMember') # first try
     class Meta:
         proxy = True

 class BoardMember(models.Model):
     content_type = models.ForeignKey(ContentType)
     object_id = models.PositiveIntegerField()
     content_object = GenericForeignKey('content_type', 'object_id',
 for_concrete_model=False)
     responsabilities = models.CharField(max_length=255)
 }}}

 In the 'first try', deleting the `Teacher` record (proxy) does not delete
 the `BoardMember` record. However, in the 'second try', deleting the
 `Person` record (concrete), does delete the `BoardMember` record.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29387>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.28b91c93a03ad6afd8831cfc64cbb780%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to