0
0
mirror of https://github.com/django/django.git synced 2024-11-22 03:18:31 +01:00
django/tests/nested_foreign_keys/models.py

31 lines
668 B
Python

from django.db import models
class Person(models.Model):
name = models.CharField(max_length=200)
class Movie(models.Model):
title = models.CharField(max_length=200)
director = models.ForeignKey(Person, models.CASCADE)
class Event(models.Model):
pass
class Screening(Event):
movie = models.ForeignKey(Movie, models.CASCADE)
class ScreeningNullFK(Event):
movie = models.ForeignKey(Movie, models.SET_NULL, null=True)
class Package(models.Model):
screening = models.ForeignKey(Screening, models.SET_NULL, null=True)
class PackageNullFK(models.Model):
screening = models.ForeignKey(ScreeningNullFK, models.SET_NULL, null=True)