[Django] #29387: GenericRelation's on proxy models do not cascade deletion

7 views
Skip to first unread message

Django

unread,
May 7, 2018, 3:33:58 PM5/7/18
to django-...@googlegroups.com
#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.

Django

unread,
May 9, 2018, 4:26:29 AM5/9/18
to django-...@googlegroups.com
#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 | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Carlton Gibson):

* Attachment "29387-regression-test.patch" added.

Regression test — already passes

Django

unread,
May 9, 2018, 4:28:35 AM5/9/18
to django-...@googlegroups.com
#29387: GenericRelation's on proxy models do not cascade deletion
-------------------------------+--------------------------------------

Reporter: Mehmet Dogan | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 2.0
Severity: Normal | Resolution: worksforme

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Carlton Gibson):

* status: new => closed
* resolution: => worksforme


Comment:

I uploaded a regression test attempting to reproduce this. It already
passes.

If we can get a failing test case reproducing the issue then we could look
into it. Pending that I'm going to close.

--
Ticket URL: <https://code.djangoproject.com/ticket/29387#comment:1>

Reply all
Reply to author
Forward
0 new messages