2011-04-20 20:42:07 +00:00
|
|
|
from django.db import models
|
|
|
|
|
2011-10-13 18:04:12 +00:00
|
|
|
|
2020-02-08 04:52:09 +00:00
|
|
|
class Entity(models.Model):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class Country(Entity):
|
2017-06-29 20:00:15 +00:00
|
|
|
name = models.CharField(max_length=30)
|
|
|
|
|
|
|
|
|
2019-12-02 06:57:19 +00:00
|
|
|
class EUCountry(Country):
|
|
|
|
join_date = models.DateField()
|
|
|
|
|
|
|
|
|
2017-06-29 20:00:15 +00:00
|
|
|
class City(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
|
|
|
country = models.ForeignKey(Country, models.CASCADE)
|
|
|
|
|
|
|
|
|
2019-12-02 06:57:19 +00:00
|
|
|
class EUCity(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
|
|
|
country = models.ForeignKey(EUCountry, models.CASCADE)
|
|
|
|
|
|
|
|
|
2011-04-20 20:42:07 +00:00
|
|
|
class Person(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
2017-06-29 20:00:15 +00:00
|
|
|
born = models.ForeignKey(City, models.CASCADE, related_name='+')
|
|
|
|
died = models.ForeignKey(City, models.CASCADE, related_name='+')
|
2017-10-17 03:28:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PersonProfile(models.Model):
|
|
|
|
person = models.OneToOneField(Person, models.CASCADE, related_name='profile')
|