2014-05-15 19:41:55 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2008-07-19 01:54:34 +02:00
|
|
|
from django.db import models
|
2012-08-12 12:32:08 +02:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2008-07-19 01:54:34 +02:00
|
|
|
|
2010-10-14 03:40:20 +02:00
|
|
|
|
2008-07-19 01:54:34 +02:00
|
|
|
class School(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
2013-11-03 05:36:09 +01:00
|
|
|
|
2008-07-19 01:54:34 +02:00
|
|
|
class Parent(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
2013-11-03 05:36:09 +01:00
|
|
|
|
2008-07-19 01:54:34 +02:00
|
|
|
class Child(models.Model):
|
|
|
|
mother = models.ForeignKey(Parent, related_name='mothers_children')
|
|
|
|
father = models.ForeignKey(Parent, related_name='fathers_children')
|
|
|
|
school = models.ForeignKey(School)
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
2013-11-03 05:36:09 +01:00
|
|
|
|
2012-08-12 12:32:08 +02:00
|
|
|
@python_2_unicode_compatible
|
2009-03-31 21:55:20 +02:00
|
|
|
class Poet(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
2012-08-12 12:32:08 +02:00
|
|
|
def __str__(self):
|
2009-03-31 21:55:20 +02:00
|
|
|
return self.name
|
|
|
|
|
2013-11-03 05:36:09 +01:00
|
|
|
|
2012-08-12 12:32:08 +02:00
|
|
|
@python_2_unicode_compatible
|
2009-03-31 21:55:20 +02:00
|
|
|
class Poem(models.Model):
|
|
|
|
poet = models.ForeignKey(Poet)
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
2012-08-12 12:32:08 +02:00
|
|
|
def __str__(self):
|
2009-03-31 21:55:20 +02:00
|
|
|
return self.name
|