Code

Ticket #17918: 17918.patch

File 17918.patch, 1.2 KB (added by nate_b, 2 years ago)
  • django/db/models/deletion.py

    From 6be9facf41c8c2351af8abba2f0b0e7b8e3270e8 Mon Sep 17 00:00:00 2001
    From: Nate Bragg <jonathan.bragg@alum.rpi.edu>
    Date: Fri, 16 Mar 2012 11:33:37 -0400
    Subject: [PATCH] Fixed sporadic failure of deleting proxy objects.
    
    This was caused by there being no indication of
    a dependancy between the proxy model and the base
    model.  Usually, this would work fine.  But
    sporadically, it would fail as a result of a list
    ordering that was not being corrected by sort(),
    because of this missing dependancy.
    ---
     django/db/models/deletion.py |    2 ++
     1 files changed, 2 insertions(+), 0 deletions(-)
    
    diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py
    index 7d6594a..9aa944c 100644
    a b class Collector(object): 
    156156                             source_attr=ptr.rel.related_name, 
    157157                             collect_related=False, 
    158158                             reverse_dependency=True) 
     159            else: 
     160                self.dependencies.setdefault(parent_model, set()).add(model) 
    159161 
    160162        if collect_related: 
    161163            for related in model._meta.get_all_related_objects(