2010-03-15 14:15:01 +01:00
|
|
|
from django.contrib.contenttypes import generic
|
|
|
|
from django.contrib.contenttypes.models import ContentType
|
2011-10-13 20:51:33 +02:00
|
|
|
from django.db import models
|
|
|
|
|
2010-03-15 14:15:01 +01:00
|
|
|
class Award(models.Model):
|
|
|
|
name = models.CharField(max_length=25)
|
|
|
|
object_id = models.PositiveIntegerField()
|
|
|
|
content_type = models.ForeignKey(ContentType)
|
|
|
|
content_object = generic.GenericForeignKey()
|
|
|
|
|
|
|
|
class AwardNote(models.Model):
|
|
|
|
award = models.ForeignKey(Award)
|
|
|
|
note = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class Person(models.Model):
|
|
|
|
name = models.CharField(max_length=25)
|
|
|
|
awards = generic.GenericRelation(Award)
|
2009-06-03 15:23:19 +02:00
|
|
|
|
|
|
|
class Book(models.Model):
|
|
|
|
pagecount = models.IntegerField()
|
|
|
|
|
2010-03-15 14:15:01 +01:00
|
|
|
class Toy(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
|
|
|
|
class Child(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
toys = models.ManyToManyField(Toy, through='PlayedWith')
|
|
|
|
|
|
|
|
class PlayedWith(models.Model):
|
|
|
|
child = models.ForeignKey(Child)
|
|
|
|
toy = models.ForeignKey(Toy)
|
2010-04-04 19:42:23 +02:00
|
|
|
date = models.DateField(db_column='date_col')
|
2010-03-15 14:15:01 +01:00
|
|
|
|
|
|
|
class PlayedWithNote(models.Model):
|
|
|
|
played = models.ForeignKey(PlayedWith)
|
|
|
|
note = models.TextField()
|
2011-01-19 22:56:14 +01:00
|
|
|
|
|
|
|
class Contact(models.Model):
|
|
|
|
label = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class Email(Contact):
|
|
|
|
email_address = models.EmailField(max_length=100)
|
|
|
|
|
|
|
|
class Researcher(models.Model):
|
|
|
|
contacts = models.ManyToManyField(Contact, related_name="research_contacts")
|
2011-01-25 04:14:28 +01:00
|
|
|
|
|
|
|
class Food(models.Model):
|
|
|
|
name = models.CharField(max_length=20, unique=True)
|
|
|
|
|
|
|
|
class Eaten(models.Model):
|
|
|
|
food = models.ForeignKey(Food, to_field="name")
|
|
|
|
meal = models.CharField(max_length=20)
|
2011-05-30 18:04:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Models for #15776
|
|
|
|
|
|
|
|
class Policy(models.Model):
|
|
|
|
policy_number = models.CharField(max_length=10)
|
|
|
|
|
|
|
|
class Version(models.Model):
|
|
|
|
policy = models.ForeignKey(Policy)
|
|
|
|
|
|
|
|
class Location(models.Model):
|
|
|
|
version = models.ForeignKey(Version, blank=True, null=True)
|
|
|
|
|
|
|
|
class Item(models.Model):
|
|
|
|
version = models.ForeignKey(Version)
|
|
|
|
location = models.ForeignKey(Location, blank=True, null=True)
|
2012-03-05 04:41:01 +01:00
|
|
|
|
|
|
|
# Models for #16128
|
|
|
|
|
|
|
|
class File(models.Model):
|
|
|
|
pass
|
|
|
|
|
|
|
|
class Image(File):
|
|
|
|
class Meta:
|
|
|
|
proxy = True
|
|
|
|
|
|
|
|
class Photo(Image):
|
|
|
|
class Meta:
|
|
|
|
proxy = True
|
|
|
|
|
|
|
|
class FooImage(models.Model):
|
|
|
|
my_image = models.ForeignKey(Image)
|
|
|
|
|
|
|
|
class FooFile(models.Model):
|
|
|
|
my_file = models.ForeignKey(File)
|
|
|
|
|
|
|
|
class FooPhoto(models.Model):
|
|
|
|
my_photo = models.ForeignKey(Photo)
|
|
|
|
|
2012-03-17 02:24:39 +01:00
|
|
|
class FooFileProxy(FooFile):
|
|
|
|
class Meta:
|
|
|
|
proxy = True
|
2012-10-10 14:58:39 +02:00
|
|
|
|
|
|
|
class OrgUnit(models.Model):
|
|
|
|
name = models.CharField(max_length=64, unique=True)
|
|
|
|
|
|
|
|
class Login(models.Model):
|
|
|
|
description = models.CharField(max_length=32)
|
|
|
|
orgunit = models.ForeignKey(OrgUnit)
|
2013-02-10 18:49:28 +01:00
|
|
|
|
|
|
|
class House(models.Model):
|
|
|
|
address = models.CharField(max_length=32)
|
|
|
|
|
|
|
|
class OrderedPerson(models.Model):
|
|
|
|
name = models.CharField(max_length=32)
|
|
|
|
lives_in = models.ForeignKey(House)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ['name']
|