2009-05-03 15:38:36 +02:00
|
|
|
"""
|
|
|
|
Testing of admin inline formsets.
|
|
|
|
|
|
|
|
"""
|
|
|
|
from django.db import models
|
|
|
|
from django.contrib.contenttypes.models import ContentType
|
|
|
|
from django.contrib.contenttypes import generic
|
2011-09-20 20:16:49 +02:00
|
|
|
|
2009-05-03 15:38:36 +02:00
|
|
|
|
|
|
|
class Parent(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2011-09-20 20:16:49 +02:00
|
|
|
|
2009-05-03 15:38:36 +02:00
|
|
|
class Teacher(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2011-09-20 20:16:49 +02:00
|
|
|
|
2009-05-03 15:38:36 +02:00
|
|
|
class Child(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
teacher = models.ForeignKey(Teacher)
|
|
|
|
|
|
|
|
content_type = models.ForeignKey(ContentType)
|
|
|
|
object_id = models.PositiveIntegerField()
|
|
|
|
parent = generic.GenericForeignKey()
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return u'I am %s, a child of %s' % (self.name, self.parent)
|
|
|
|
|
2011-09-20 20:16:49 +02:00
|
|
|
|
2010-04-27 14:35:49 +02:00
|
|
|
class Book(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
|
2011-09-20 20:16:49 +02:00
|
|
|
|
2010-04-27 14:35:49 +02:00
|
|
|
class Author(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
books = models.ManyToManyField(Book)
|
|
|
|
|
2010-02-23 18:14:50 +01:00
|
|
|
|
|
|
|
class Holder(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
|
|
|
|
|
|
|
|
class Inner(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
holder = models.ForeignKey(Holder)
|
2010-03-27 00:38:05 +01:00
|
|
|
readonly = models.CharField("Inner readonly label", max_length=1)
|
2010-02-23 18:14:50 +01:00
|
|
|
|
|
|
|
|
2010-03-21 02:54:00 +01:00
|
|
|
class Holder2(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
|
|
|
|
|
|
|
|
class Inner2(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
holder = models.ForeignKey(Holder2)
|
|
|
|
|
|
|
|
class Holder3(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
|
|
|
|
|
|
|
|
class Inner3(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
holder = models.ForeignKey(Holder3)
|
|
|
|
|
2011-08-17 16:12:25 +02:00
|
|
|
# Models for ticket #8190
|
|
|
|
|
|
|
|
class Holder4(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
|
|
|
|
class Inner4Stacked(models.Model):
|
|
|
|
dummy = models.IntegerField(help_text="Awesome stacked help text is awesome.")
|
|
|
|
holder = models.ForeignKey(Holder4)
|
|
|
|
|
|
|
|
class Inner4Tabular(models.Model):
|
|
|
|
dummy = models.IntegerField(help_text="Awesome tabular help text is awesome.")
|
|
|
|
holder = models.ForeignKey(Holder4)
|
|
|
|
|
|
|
|
|
2010-04-27 17:05:38 +02:00
|
|
|
# Models for #12749
|
|
|
|
|
|
|
|
class Person(models.Model):
|
|
|
|
firstname = models.CharField(max_length=15)
|
|
|
|
|
|
|
|
class OutfitItem(models.Model):
|
|
|
|
name = models.CharField(max_length=15)
|
|
|
|
|
|
|
|
class Fashionista(models.Model):
|
|
|
|
person = models.OneToOneField(Person, primary_key=True)
|
|
|
|
weaknesses = models.ManyToManyField(OutfitItem, through='ShoppingWeakness', blank=True)
|
|
|
|
|
|
|
|
class ShoppingWeakness(models.Model):
|
|
|
|
fashionista = models.ForeignKey(Fashionista)
|
|
|
|
item = models.ForeignKey(OutfitItem)
|
|
|
|
|
2011-02-22 04:07:57 +01:00
|
|
|
# Models for #13510
|
|
|
|
|
|
|
|
class TitleCollection(models.Model):
|
|
|
|
pass
|
|
|
|
|
|
|
|
class Title(models.Model):
|
|
|
|
collection = models.ForeignKey(TitleCollection, blank=True, null=True)
|
|
|
|
title1 = models.CharField(max_length=100)
|
|
|
|
title2 = models.CharField(max_length=100)
|
|
|
|
|
2011-02-26 02:44:41 +01:00
|
|
|
# Models for #15424
|
|
|
|
|
|
|
|
class Poll(models.Model):
|
|
|
|
name = models.CharField(max_length=40)
|
|
|
|
|
|
|
|
class Question(models.Model):
|
|
|
|
poll = models.ForeignKey(Poll)
|
|
|
|
|
|
|
|
class Novel(models.Model):
|
|
|
|
name = models.CharField(max_length=40)
|
|
|
|
|
|
|
|
class Chapter(models.Model):
|
|
|
|
novel = models.ForeignKey(Novel)
|
|
|
|
|
2011-09-21 16:00:58 +02:00
|
|
|
|
|
|
|
# Models for #16838
|
|
|
|
class CapoFamiglia(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
|
|
|
|
class Consigliere(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
capo_famiglia = models.ForeignKey(CapoFamiglia, related_name='+')
|
|
|
|
|
|
|
|
|
|
|
|
class SottoCapo(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
capo_famiglia = models.ForeignKey(CapoFamiglia, related_name='+')
|