=== modified file 'tests/modeltests/model_inheritance/models.py'
|
|
|
249 | 249 | >>> list(ItalianRestaurant.objects.values('name', 'rating')) == [d] |
250 | 250 | True |
251 | 251 | |
| 252 | # Deleting a child will also delete the parent |
| 253 | >>> park1.parent.id |
| 254 | 7 |
| 255 | >>> Place.objects.get (id = 7) |
| 256 | <Place: Main St the place> |
| 257 | >>> park1.delete () |
| 258 | >>> Place.objects.get (id = 7) |
| 259 | Traceback (most recent call last): |
| 260 | ... |
| 261 | DoesNotExist: Place matching query does not exist. |
| 262 | |
252 | 263 | # select_related works with fields from the parent object as if they were a |
253 | 264 | # normal part of the model. |
254 | 265 | >>> from django import db |