2012-08-22 02:54:14 +08:00
|
|
|
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)
|
2015-07-22 22:43:21 +08:00
|
|
|
director = models.ForeignKey(Person, models.CASCADE)
|
2012-08-22 02:54:14 +08:00
|
|
|
|
|
|
|
|
|
|
|
class Event(models.Model):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class Screening(Event):
|
2015-07-22 22:43:21 +08:00
|
|
|
movie = models.ForeignKey(Movie, models.CASCADE)
|
2012-08-22 02:54:14 +08:00
|
|
|
|
2013-11-03 05:34:05 +08:00
|
|
|
|
2012-08-22 02:54:14 +08:00
|
|
|
class ScreeningNullFK(Event):
|
2015-07-22 22:43:21 +08:00
|
|
|
movie = models.ForeignKey(Movie, models.SET_NULL, null=True)
|
2012-08-22 02:54:14 +08:00
|
|
|
|
|
|
|
|
|
|
|
class Package(models.Model):
|
2015-07-22 22:43:21 +08:00
|
|
|
screening = models.ForeignKey(Screening, models.SET_NULL, null=True)
|
2012-08-22 02:54:14 +08:00
|
|
|
|
2013-11-03 05:34:05 +08:00
|
|
|
|
2012-08-22 02:54:14 +08:00
|
|
|
class PackageNullFK(models.Model):
|
2015-07-22 22:43:21 +08:00
|
|
|
screening = models.ForeignKey(ScreeningNullFK, models.SET_NULL, null=True)
|