Opened 7 years ago
Closed 7 years ago
#29387 closed Uncategorized (worksforme)
GenericRelation's on proxy models do not cascade deletion
Reported by: | Mehmet Dogan | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 2.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
For this code (from 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.
Attachments (1)
Change History (2)
by , 7 years ago
Attachment: | 29387-regression-test.patch added |
---|
comment:1 by , 7 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
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.
Note:
See TracTickets
for help on using tickets.
Regression test — already passes