Loading django/contrib/admin/util.py +0 −3 Original line number Diff line number Diff line Loading @@ -155,9 +155,6 @@ class NestedObjects(Collector): if source_attr: self.add_edge(getattr(obj, source_attr), obj) else: if obj._meta.proxy: # Take concrete model's instance to avoid mismatch in edges obj = obj._meta.concrete_model(pk=obj.pk) self.add_edge(None, obj) try: return super(NestedObjects, self).collect(objs, source_attr=source_attr, **kwargs) Loading docs/ref/models/instances.txt +3 −3 Original line number Diff line number Diff line Loading @@ -500,9 +500,9 @@ using ``__str__()`` like this:: .. method:: Model.__eq__() The equality method is defined such that instances with the same primary key value and the same concrete class are considered equal. The term concrete class means proxy model's first non-proxy parent or the class itself if it isn't a proxy class. key value and the same concrete class are considered equal. For proxy models, concrete class is defined as the model's first non-proxy parent; for all other models it is simply the model's class. For example:: Loading tests/proxy_models/admin.py 0 → 100644 +6 −0 Original line number Diff line number Diff line from django.contrib import admin from .models import TrackerUser, ProxyTrackerUser admin.site.register(TrackerUser) admin.site.register(ProxyTrackerUser) tests/proxy_models/fixtures/myhorses.json +19 −1 Original line number Diff line number Diff line [ { "pk": 100, "model": "auth.user", "fields": { "username": "super", "first_name": "Super", "last_name": "User", "is_active": true, "is_superuser": true, "is_staff": true, "last_login": "2007-05-30 13:20:10", "groups": [], "user_permissions": [], "password": "sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158", "email": "super@example.com", "date_joined": "2007-05-30 13:20:10" } }, { "pk": 100, "model": "proxy_models.BaseUser", Loading tests/proxy_models/models.py +5 −1 Original line number Diff line number Diff line Loading @@ -117,9 +117,13 @@ class StateProxy(State): # Proxy models still works with filters (on related fields) # and select_related, even when mixed with model inheritance @python_2_unicode_compatible class BaseUser(models.Model): name = models.CharField(max_length=255) def __str__(self): return ':'.join((self.__class__.__name__, self.name,)) class TrackerUser(BaseUser): status = models.CharField(max_length=50) Loading Loading
django/contrib/admin/util.py +0 −3 Original line number Diff line number Diff line Loading @@ -155,9 +155,6 @@ class NestedObjects(Collector): if source_attr: self.add_edge(getattr(obj, source_attr), obj) else: if obj._meta.proxy: # Take concrete model's instance to avoid mismatch in edges obj = obj._meta.concrete_model(pk=obj.pk) self.add_edge(None, obj) try: return super(NestedObjects, self).collect(objs, source_attr=source_attr, **kwargs) Loading
docs/ref/models/instances.txt +3 −3 Original line number Diff line number Diff line Loading @@ -500,9 +500,9 @@ using ``__str__()`` like this:: .. method:: Model.__eq__() The equality method is defined such that instances with the same primary key value and the same concrete class are considered equal. The term concrete class means proxy model's first non-proxy parent or the class itself if it isn't a proxy class. key value and the same concrete class are considered equal. For proxy models, concrete class is defined as the model's first non-proxy parent; for all other models it is simply the model's class. For example:: Loading
tests/proxy_models/admin.py 0 → 100644 +6 −0 Original line number Diff line number Diff line from django.contrib import admin from .models import TrackerUser, ProxyTrackerUser admin.site.register(TrackerUser) admin.site.register(ProxyTrackerUser)
tests/proxy_models/fixtures/myhorses.json +19 −1 Original line number Diff line number Diff line [ { "pk": 100, "model": "auth.user", "fields": { "username": "super", "first_name": "Super", "last_name": "User", "is_active": true, "is_superuser": true, "is_staff": true, "last_login": "2007-05-30 13:20:10", "groups": [], "user_permissions": [], "password": "sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158", "email": "super@example.com", "date_joined": "2007-05-30 13:20:10" } }, { "pk": 100, "model": "proxy_models.BaseUser", Loading
tests/proxy_models/models.py +5 −1 Original line number Diff line number Diff line Loading @@ -117,9 +117,13 @@ class StateProxy(State): # Proxy models still works with filters (on related fields) # and select_related, even when mixed with model inheritance @python_2_unicode_compatible class BaseUser(models.Model): name = models.CharField(max_length=255) def __str__(self): return ':'.join((self.__class__.__name__, self.name,)) class TrackerUser(BaseUser): status = models.CharField(max_length=50) Loading