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