'Test that if a M2M relationship has an explicitly-specified
through model, and some other model has an FK to that through
model, deletion is cascaded from one of the participants in
the M2M, to the through model, to its related model.
Like the above test, this could in theory falsely succeed if
the DB cascades deletes itself immediately.'

def test_fk_to_m2m_through(self):

    juan = Child.objects.create(name='Juan')
    paints = Toy.objects.create(name='Paints')
    played = PlayedWith.objects.create(child=juan, toy=paints, date=datetime.date.today())
    note = PlayedWithNote.objects.create(played=played, note='the    next    Jackson    Pollock')
    self.assertEquals(PlayedWithNote.objects.count(), 1)
    paints.delete()
    self.assertEquals(PlayedWith.objects.count(), 0)
    self.assertEquals(PlayedWithNote.objects.count(), 0)
