Django

Code

Ticket #7276: delete-parent-objects-test.diff

File delete-parent-objects-test.diff, 0.7 kB (added by jmillikin, 6 months ago)

Updated model inheritance unit tests

  • tests/modeltests/model_inheritance/models.py

    old new  
    249249>>> list(ItalianRestaurant.objects.values('name', 'rating')) == [d] 
    250250True 
    251251 
     252# Deleting a child will also delete the parent 
     253>>> park1.parent.id 
     2547 
     255>>> Place.objects.get (id = 7) 
     256<Place: Main St the place> 
     257>>> park1.delete () 
     258>>> Place.objects.get (id = 7) 
     259Traceback (most recent call last): 
     260    ... 
     261DoesNotExist: Place matching query does not exist. 
     262 
    252263# select_related works with fields from the parent object as if they were a 
    253264# normal part of the model. 
    254265>>> from django import db