Ticket #11116: 11116_model_proxy_delete_with_test.diff

File 11116_model_proxy_delete_with_test.diff, 1.2 KB (added by samueladam, 15 years ago)

Added test

  • django/db/models/base.py

     
    538538        # traversing to the most remote parent classes -- those with no parents
    539539        # themselves -- and then adding those instances to the collection. That
    540540        # will include all the child instances down to "self".
    541         parent_stack = self._meta.parents.values()
     541        parent_stack = filter(None, self._meta.parents.values())
    542542        while parent_stack:
    543543            link = parent_stack.pop()
    544544            parent_obj = getattr(self, link.name)
  • tests/modeltests/proxy_models/models.py

     
    275275[<UserProxy: Bruce>]
    276276>>> UserProxyProxy.objects.all()
    277277[<UserProxyProxy: Bruce>]
     278>>> u2 = UserProxy.objects.create(name='Try to delete me')
     279>>> u2.delete()
    278280
    279281# We can still use `select_related()` to include related models in our querysets.
    280282>>> country = Country.objects.create(name='Australia')
Back to Top