Ticket #14896: django-14896.diff

File django-14896.diff, 2.0 KB (added by Alex Gaynor, 13 years ago)

I can't reproduce this issue.

  • tests/regressiontests/delete_regress/models.py

    diff --git a/tests/regressiontests/delete_regress/models.py b/tests/regressiontests/delete_regress/models.py
    index 8109c0a..77330ec 100644
    a b class PlayedWith(models.Model):  
    3535class PlayedWithNote(models.Model):
    3636    played = models.ForeignKey(PlayedWith)
    3737    note = models.TextField()
     38
     39
     40class Contact(models.Model):
     41    label = models.CharField(max_length=100)
     42
     43class Email(Contact):
     44    email_address = models.EmailField(max_length=100)
     45
     46class Researcher(Contact):
     47    contacts = models.ManyToManyField(Contact, related_name="research_contacts")
  • tests/regressiontests/delete_regress/tests.py

    diff --git a/tests/regressiontests/delete_regress/tests.py b/tests/regressiontests/delete_regress/tests.py
    index 754031b..6c7984c 100644
    a b from django.conf import settings  
    44from django.db import backend, connection, transaction, DEFAULT_DB_ALIAS
    55from django.test import TestCase, TransactionTestCase, skipUnlessDBFeature
    66
    7 from models import Book, Award, AwardNote, Person, Child, Toy, PlayedWith, PlayedWithNote
     7from models import (Book, Award, AwardNote, Person, Child, Toy, PlayedWith,
     8    PlayedWithNote, Contact, Email, Researcher)
    89
    910
    1011# Can't run this test under SQLite, because you can't
    class DeleteCascadeTests(TestCase):  
    108109        # first two asserts just sanity checks, this is the kicker:
    109110        self.assertEquals(PlayedWithNote.objects.count(), 0)
    110111
     112    def test_inheritance(self):
     113        r = Researcher.objects.create(label="Carl")
     114        email = Email.objects.create(
     115            label="office-email", email_address="carl@science.edu"
     116        )
     117        r.contacts.add(email)
     118
     119        email.delete()
     120
    111121class LargeDeleteTests(TestCase):
    112122    def test_large_deletes(self):
    113123        "Regression for #13309 -- if the number of objects > chunk size, deletion still occurs"
Back to Top