from django.contrib.contenttypes.fields import (
    GenericForeignKey, GenericRelation
)
from django.contrib.contenttypes.models import ContentType
from django.db import models


class Award(models.Model):
    name = models.CharField(max_length=25)
    object_id = models.PositiveIntegerField()
    content_type = models.ForeignKey(ContentType)
    content_object = 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 = GenericRelation(Award)


class Book(models.Model):
    pagecount = models.IntegerField()


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)
    date = models.DateField(db_column='date_col')


class PlayedWithNote(models.Model):
    played = models.ForeignKey(PlayedWith)
    note = models.TextField()


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")


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)


# 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)

# 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)


class FooFileProxy(FooFile):
    class Meta:
        proxy = True


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)


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']

[(9, 'django.db.models.CharField', 'models.CharField', False, 'from django.db import models\n'), (10, 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', False, 'from django.db import models\n'), (11, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (12, 'django.contrib.contenttypes.fields.GenericForeignKey', 'GenericForeignKey', False, 'from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation\n'), (16, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (17, 'django.db.models.CharField', 'models.CharField', False, 'from django.db import models\n'), (21, 'django.db.models.CharField', 'models.CharField', False, 'from django.db import models\n'), (22, 'django.contrib.contenttypes.fields.GenericRelation', 'GenericRelation', False, 'from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation\n'), (26, 'django.db.models.IntegerField', 'models.IntegerField', False, 'from django.db import models\n'), (30, 'django.db.models.CharField', 'models.CharField', False, 'from django.db import models\n'), (34, 'django.db.models.CharField', 'models.CharField', False, 'from django.db import models\n'), (35, 'django.db.models.ManyToManyField', 'models.ManyToManyField', False, 'from django.db import models\n'), (39, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (40, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (41, 'django.db.models.DateField', 'models.DateField', False, 'from django.db import models\n'), (45, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (46, 'django.db.models.TextField', 'models.TextField', False, 'from django.db import models\n'), (50, 'django.db.models.CharField', 'models.CharField', False, 'from django.db import models\n'), (54, 'django.db.models.EmailField', 'models.EmailField', False, 'from django.db import models\n'), (58, 'django.db.models.ManyToManyField', 'models.ManyToManyField', False, 'from django.db import models\n'), (62, 'django.db.models.CharField', 'models.CharField', False, 'from django.db import models\n'), (66, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (67, 'django.db.models.CharField', 'models.CharField', False, 'from django.db import models\n'), (74, 'django.db.models.CharField', 'models.CharField', False, 'from django.db import models\n'), (78, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (82, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (86, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (87, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (107, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (111, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (115, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (124, 'django.db.models.CharField', 'models.CharField', False, 'from django.db import models\n'), (128, 'django.db.models.CharField', 'models.CharField', False, 'from django.db import models\n'), (129, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n'), (133, 'django.db.models.CharField', 'models.CharField', False, 'from django.db import models\n'), (137, 'django.db.models.CharField', 'models.CharField', False, 'from django.db import models\n'), (138, 'django.db.models.ForeignKey', 'models.ForeignKey', False, 'from django.db import models\n')]