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