Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.6.x] Revert "Fixed #18491 -- deleting a proxy doesn't show warning…

… about cascade deletes"

This reverts commit 2b48fcc.

It introduced a regression (#20777) which we can't easily fix in 1.6.
  • Loading branch information...
commit c769c266017c9a527444f8f026c7a76b394d0412 1 parent 9199346
Tim Graham authored August 16, 2013
3  django/contrib/admin/util.py
@@ -155,9 +155,6 @@ def collect(self, objs, source_attr=None, **kwargs):
155 155
             if source_attr:
156 156
                 self.add_edge(getattr(obj, source_attr), obj)
157 157
             else:
158  
-                if obj._meta.proxy:
159  
-                    # Take concrete model's instance to avoid mismatch in edges
160  
-                    obj = obj._meta.concrete_model(pk=obj.pk)
161 158
                 self.add_edge(None, obj)
162 159
         try:
163 160
             return super(NestedObjects, self).collect(objs, source_attr=source_attr, **kwargs)
24  tests/proxy_models/fixtures/myhorses.json
... ...
@@ -1,24 +0,0 @@
1  
-[
2  
-    {
3  
-        "pk": 100,
4  
-        "model": "proxy_models.BaseUser",
5  
-        "fields": {
6  
-            "name": "Django Pony"
7  
-        }
8  
-    },
9  
-    {
10  
-        "pk": 100,
11  
-        "model": "proxy_models.TrackerUser",
12  
-        "fields": {
13  
-            "status": "emperor"
14  
-        }
15  
-    },
16  
-    {
17  
-        "pk": 100,
18  
-        "model": "proxy_models.Issue",
19  
-        "fields": {
20  
-            "summary": "Pony's Issue",
21  
-            "assignee": 100
22  
-        }
23  
-    }
24  
-]
22  tests/proxy_models/tests.py
@@ -2,7 +2,6 @@
2 2
 import copy
3 3
 
4 4
 from django.conf import settings
5  
-from django.contrib import admin
6 5
 from django.contrib.contenttypes.models import ContentType
7 6
 from django.core import management
8 7
 from django.core.exceptions import FieldError
@@ -15,7 +14,7 @@
15 14
 from .models import (MyPerson, Person, StatusPerson, LowerStatusPerson,
16 15
     MyPersonProxy, Abstract, OtherPerson, User, UserProxy, UserProxyProxy,
17 16
     Country, State, StateProxy, TrackerUser, BaseUser, Bug, ProxyTrackerUser,
18  
-    Improvement, ProxyProxyBug, ProxyBug, ProxyImprovement, Issue)
  17
+    Improvement, ProxyProxyBug, ProxyBug, ProxyImprovement)
19 18
 
20 19
 
21 20
 class ProxyModelTests(TestCase):
@@ -361,22 +360,3 @@ def test_proxy_load_from_fixture(self):
361 360
         management.call_command('loaddata', 'mypeople.json', verbosity=0)
362 361
         p = MyPerson.objects.get(pk=100)
363 362
         self.assertEqual(p.name, 'Elvis Presley')
364  
-
365  
-
366  
-class ProxyModelAdminTests(TestCase):
367  
-    fixtures = ['myhorses']
368  
-
369  
-    def test_cascade_delete_proxy_model_admin_warning(self):
370  
-        """
371  
-        Test if admin gives warning about cascade deleting models referenced
372  
-        to concrete model by deleting proxy object.
373  
-        """
374  
-        tracker_user = TrackerUser.objects.all()[0]
375  
-        base_user = BaseUser.objects.all()[0]
376  
-        issue = Issue.objects.all()[0]
377  
-        with self.assertNumQueries(7):
378  
-            collector = admin.util.NestedObjects('default')
379  
-            collector.collect(ProxyTrackerUser.objects.all())
380  
-        self.assertTrue(tracker_user in collector.edges.get(None, ()))
381  
-        self.assertTrue(base_user in collector.edges.get(None, ()))
382  
-        self.assertTrue(issue in collector.edges.get(tracker_user, ()))

0 notes on commit c769c26

Please sign in to comment.
Something went wrong with that request. Please try again.