2009-05-03 13:38:36 +00:00
|
|
|
"""
|
|
|
|
Testing of admin inline formsets.
|
|
|
|
"""
|
2024-01-26 11:45:07 +00:00
|
|
|
|
2013-07-19 19:55:16 +00:00
|
|
|
import random
|
2024-04-21 18:06:12 +00:00
|
|
|
import uuid
|
2012-06-07 16:08:47 +00:00
|
|
|
|
2014-01-22 06:43:33 +00:00
|
|
|
from django.contrib.contenttypes.fields import GenericForeignKey
|
2009-05-03 13:38:36 +00:00
|
|
|
from django.contrib.contenttypes.models import ContentType
|
2022-03-01 07:09:58 +00:00
|
|
|
from django.core.exceptions import ValidationError
|
2015-01-28 12:35:27 +00:00
|
|
|
from django.db import models
|
2011-09-20 18:16:49 +00:00
|
|
|
|
2009-05-03 13:38:36 +00:00
|
|
|
|
|
|
|
class Parent(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
|
2012-08-12 10:32:08 +00:00
|
|
|
def __str__(self):
|
2009-05-03 13:38:36 +00:00
|
|
|
return self.name
|
|
|
|
|
2011-09-20 18:16:49 +00:00
|
|
|
|
2009-05-03 13:38:36 +00:00
|
|
|
class Teacher(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
|
2012-08-12 10:32:08 +00:00
|
|
|
def __str__(self):
|
2009-05-03 13:38:36 +00:00
|
|
|
return self.name
|
|
|
|
|
2011-09-20 18:16:49 +00:00
|
|
|
|
2009-05-03 13:38:36 +00:00
|
|
|
class Child(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
2015-07-22 14:43:21 +00:00
|
|
|
teacher = models.ForeignKey(Teacher, models.CASCADE)
|
2009-05-03 13:38:36 +00:00
|
|
|
|
2015-07-22 14:43:21 +00:00
|
|
|
content_type = models.ForeignKey(ContentType, models.CASCADE)
|
2009-05-03 13:38:36 +00:00
|
|
|
object_id = models.PositiveIntegerField()
|
2014-01-22 06:43:33 +00:00
|
|
|
parent = GenericForeignKey()
|
2009-05-03 13:38:36 +00:00
|
|
|
|
2012-08-12 10:32:08 +00:00
|
|
|
def __str__(self):
|
2012-06-07 16:08:47 +00:00
|
|
|
return "I am %s, a child of %s" % (self.name, self.parent)
|
2009-05-03 13:38:36 +00:00
|
|
|
|
2011-09-20 18:16:49 +00:00
|
|
|
|
2010-04-27 12:35:49 +00:00
|
|
|
class Book(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
|
2019-03-30 17:58:33 +00:00
|
|
|
def __str__(self):
|
|
|
|
return self.name
|
|
|
|
|
2011-09-20 18:16:49 +00:00
|
|
|
|
2010-04-27 12:35:49 +00:00
|
|
|
class Author(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
books = models.ManyToManyField(Book)
|
2021-01-15 14:32:54 +00:00
|
|
|
person = models.OneToOneField("Person", models.CASCADE, null=True)
|
2010-04-27 12:35:49 +00:00
|
|
|
|
2010-02-23 17:14:50 +00:00
|
|
|
|
2013-07-19 19:55:16 +00:00
|
|
|
class NonAutoPKBook(models.Model):
|
|
|
|
rand_pk = models.IntegerField(primary_key=True, editable=False)
|
2015-07-22 14:43:21 +00:00
|
|
|
author = models.ForeignKey(Author, models.CASCADE)
|
2013-07-19 19:55:16 +00:00
|
|
|
title = models.CharField(max_length=50)
|
|
|
|
|
|
|
|
def save(self, *args, **kwargs):
|
|
|
|
while not self.rand_pk:
|
|
|
|
test_pk = random.randint(1, 99999)
|
|
|
|
if not NonAutoPKBook.objects.filter(rand_pk=test_pk).exists():
|
|
|
|
self.rand_pk = test_pk
|
2017-01-21 13:13:44 +00:00
|
|
|
super().save(*args, **kwargs)
|
2013-07-19 19:55:16 +00:00
|
|
|
|
|
|
|
|
2017-06-10 00:54:10 +00:00
|
|
|
class NonAutoPKBookChild(NonAutoPKBook):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2013-07-19 19:55:16 +00:00
|
|
|
class EditablePKBook(models.Model):
|
|
|
|
manual_pk = models.IntegerField(primary_key=True)
|
2015-07-22 14:43:21 +00:00
|
|
|
author = models.ForeignKey(Author, models.CASCADE)
|
2013-07-19 19:55:16 +00:00
|
|
|
title = models.CharField(max_length=50)
|
|
|
|
|
|
|
|
|
2010-02-23 17:14:50 +00:00
|
|
|
class Holder(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
|
|
|
|
|
|
|
|
class Inner(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
2015-07-22 14:43:21 +00:00
|
|
|
holder = models.ForeignKey(Holder, models.CASCADE)
|
2010-03-26 23:38:05 +00:00
|
|
|
readonly = models.CharField("Inner readonly label", max_length=1)
|
2010-02-23 17:14:50 +00:00
|
|
|
|
2012-09-27 13:55:27 +00:00
|
|
|
def get_absolute_url(self):
|
|
|
|
return "/inner/"
|
|
|
|
|
2010-02-23 17:14:50 +00:00
|
|
|
|
2010-03-21 01:54:00 +00:00
|
|
|
class Holder2(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
|
|
|
|
|
|
|
|
class Inner2(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
2015-07-22 14:43:21 +00:00
|
|
|
holder = models.ForeignKey(Holder2, models.CASCADE)
|
2010-03-21 01:54:00 +00:00
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2010-03-21 01:54:00 +00:00
|
|
|
class Holder3(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
|
|
|
|
|
|
|
|
class Inner3(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
2015-07-22 14:43:21 +00:00
|
|
|
holder = models.ForeignKey(Holder3, models.CASCADE)
|
2010-03-21 01:54:00 +00:00
|
|
|
|
2022-02-03 19:24:19 +00:00
|
|
|
|
2011-08-17 14:12:25 +00:00
|
|
|
# Models for ticket #8190
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2011-08-17 14:12:25 +00:00
|
|
|
class Holder4(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2011-08-17 14:12:25 +00:00
|
|
|
class Inner4Stacked(models.Model):
|
|
|
|
dummy = models.IntegerField(help_text="Awesome stacked help text is awesome.")
|
2015-07-22 14:43:21 +00:00
|
|
|
holder = models.ForeignKey(Holder4, models.CASCADE)
|
2011-08-17 14:12:25 +00:00
|
|
|
|
2019-10-24 14:37:55 +00:00
|
|
|
class Meta:
|
|
|
|
constraints = [
|
|
|
|
models.UniqueConstraint(
|
|
|
|
fields=["dummy", "holder"], name="unique_stacked_dummy_per_holder"
|
|
|
|
)
|
|
|
|
]
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2011-08-17 14:12:25 +00:00
|
|
|
class Inner4Tabular(models.Model):
|
|
|
|
dummy = models.IntegerField(help_text="Awesome tabular help text is awesome.")
|
2015-07-22 14:43:21 +00:00
|
|
|
holder = models.ForeignKey(Holder4, models.CASCADE)
|
2011-08-17 14:12:25 +00:00
|
|
|
|
2019-10-24 14:37:55 +00:00
|
|
|
class Meta:
|
|
|
|
constraints = [
|
|
|
|
models.UniqueConstraint(
|
|
|
|
fields=["dummy", "holder"], name="unique_tabular_dummy_per_holder"
|
|
|
|
)
|
|
|
|
]
|
|
|
|
|
2022-02-03 19:24:19 +00:00
|
|
|
|
2020-04-10 14:52:56 +00:00
|
|
|
# Models for ticket #31441
|
|
|
|
|
|
|
|
|
|
|
|
class Holder5(models.Model):
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
|
|
|
|
|
|
|
|
class Inner5Stacked(models.Model):
|
|
|
|
name = models.CharField(max_length=10)
|
|
|
|
select = models.CharField(choices=(("1", "One"), ("2", "Two")), max_length=10)
|
|
|
|
text = models.TextField()
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
holder = models.ForeignKey(Holder5, models.CASCADE)
|
|
|
|
|
|
|
|
|
|
|
|
class Inner5Tabular(models.Model):
|
|
|
|
name = models.CharField(max_length=10)
|
|
|
|
select = models.CharField(choices=(("1", "One"), ("2", "Two")), max_length=10)
|
|
|
|
text = models.TextField()
|
|
|
|
dummy = models.IntegerField()
|
|
|
|
holder = models.ForeignKey(Holder5, models.CASCADE)
|
|
|
|
|
|
|
|
|
2010-04-27 15:05:38 +00:00
|
|
|
# Models for #12749
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2010-04-27 15:05:38 +00:00
|
|
|
class Person(models.Model):
|
|
|
|
firstname = models.CharField(max_length=15)
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2010-04-27 15:05:38 +00:00
|
|
|
class OutfitItem(models.Model):
|
|
|
|
name = models.CharField(max_length=15)
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2010-04-27 15:05:38 +00:00
|
|
|
class Fashionista(models.Model):
|
2015-07-22 14:43:21 +00:00
|
|
|
person = models.OneToOneField(Person, models.CASCADE, primary_key=True)
|
2010-04-27 15:05:38 +00:00
|
|
|
weaknesses = models.ManyToManyField(
|
|
|
|
OutfitItem, through="ShoppingWeakness", blank=True
|
|
|
|
)
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2010-04-27 15:05:38 +00:00
|
|
|
class ShoppingWeakness(models.Model):
|
2015-07-22 14:43:21 +00:00
|
|
|
fashionista = models.ForeignKey(Fashionista, models.CASCADE)
|
|
|
|
item = models.ForeignKey(OutfitItem, models.CASCADE)
|
2010-04-27 15:05:38 +00:00
|
|
|
|
2022-02-03 19:24:19 +00:00
|
|
|
|
2024-05-22 01:09:26 +00:00
|
|
|
# Models for #35189
|
|
|
|
|
|
|
|
|
|
|
|
class Photographer(Person):
|
|
|
|
fullname = models.CharField(max_length=100)
|
|
|
|
nationality = models.CharField(max_length=100)
|
|
|
|
residency = models.CharField(max_length=100)
|
|
|
|
siblings = models.IntegerField()
|
|
|
|
children = models.IntegerField()
|
|
|
|
|
|
|
|
|
|
|
|
class Photo(models.Model):
|
|
|
|
photographer = models.ForeignKey(Photographer, on_delete=models.CASCADE)
|
|
|
|
image = models.CharField(max_length=100)
|
|
|
|
title = models.CharField(max_length=100)
|
|
|
|
description = models.TextField()
|
|
|
|
creation_date = models.DateField()
|
|
|
|
update_date = models.DateField()
|
|
|
|
updated_by = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
|
2011-02-22 03:07:57 +00:00
|
|
|
# Models for #13510
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2011-02-22 03:07:57 +00:00
|
|
|
class TitleCollection(models.Model):
|
|
|
|
pass
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2011-02-22 03:07:57 +00:00
|
|
|
class Title(models.Model):
|
2015-07-22 14:43:21 +00:00
|
|
|
collection = models.ForeignKey(
|
|
|
|
TitleCollection, models.SET_NULL, blank=True, null=True
|
|
|
|
)
|
2011-02-22 03:07:57 +00:00
|
|
|
title1 = models.CharField(max_length=100)
|
|
|
|
title2 = models.CharField(max_length=100)
|
|
|
|
|
2022-02-03 19:24:19 +00:00
|
|
|
|
2011-02-26 01:44:41 +00:00
|
|
|
# Models for #15424
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2011-02-26 01:44:41 +00:00
|
|
|
class Poll(models.Model):
|
|
|
|
name = models.CharField(max_length=40)
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2011-02-26 01:44:41 +00:00
|
|
|
class Question(models.Model):
|
2018-11-19 20:29:57 +00:00
|
|
|
text = models.CharField(max_length=40)
|
2015-07-22 14:43:21 +00:00
|
|
|
poll = models.ForeignKey(Poll, models.CASCADE)
|
2011-02-26 01:44:41 +00:00
|
|
|
|
2022-03-01 07:09:58 +00:00
|
|
|
def clean(self):
|
|
|
|
raise ValidationError("Always invalid model.")
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2011-02-26 01:44:41 +00:00
|
|
|
class Novel(models.Model):
|
|
|
|
name = models.CharField(max_length=40)
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2018-05-18 23:50:58 +00:00
|
|
|
class NovelReadonlyChapter(Novel):
|
|
|
|
class Meta:
|
|
|
|
proxy = True
|
|
|
|
|
|
|
|
|
2011-02-26 01:44:41 +00:00
|
|
|
class Chapter(models.Model):
|
2013-02-23 18:44:54 +00:00
|
|
|
name = models.CharField(max_length=40)
|
2015-07-22 14:43:21 +00:00
|
|
|
novel = models.ForeignKey(Novel, models.CASCADE)
|
2011-02-26 01:44:41 +00:00
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2013-02-23 18:44:54 +00:00
|
|
|
class FootNote(models.Model):
|
|
|
|
"""
|
|
|
|
Model added for ticket 19838
|
|
|
|
"""
|
2022-02-03 19:24:19 +00:00
|
|
|
|
2015-07-22 14:43:21 +00:00
|
|
|
chapter = models.ForeignKey(Chapter, models.PROTECT)
|
2013-02-23 18:44:54 +00:00
|
|
|
note = models.CharField(max_length=40)
|
|
|
|
|
2022-02-03 19:24:19 +00:00
|
|
|
|
2011-09-21 14:00:58 +00:00
|
|
|
# Models for #16838
|
2012-12-28 22:16:13 +00:00
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2011-09-21 14:00:58 +00:00
|
|
|
class CapoFamiglia(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
|
|
|
|
class Consigliere(models.Model):
|
2013-02-23 17:24:32 +00:00
|
|
|
name = models.CharField(max_length=100, help_text="Help text for Consigliere")
|
2015-07-22 14:43:21 +00:00
|
|
|
capo_famiglia = models.ForeignKey(CapoFamiglia, models.CASCADE, related_name="+")
|
2011-09-21 14:00:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SottoCapo(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
2015-07-22 14:43:21 +00:00
|
|
|
capo_famiglia = models.ForeignKey(CapoFamiglia, models.CASCADE, related_name="+")
|
Fixed #2879 -- Added support for the integration with Selenium and other in-browser testing frameworks. Also added the first Selenium tests for `contrib.admin`. Many thanks to everyone for their contributions and feedback: Mikeal Rogers, Dirk Datzert, mir, Simon G., Almad, Russell Keith-Magee, Denis Golomazov, devin, robertrv, andrewbadr, Idan Gazit, voidspace, Tom Christie, hjwp2, Adam Nelson, Jannis Leidel, Anssi Kääriäinen, Preston Holmes, Bruno Renié and Jacob Kaplan-Moss.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-22 08:33:58 +00:00
|
|
|
|
2013-02-23 17:24:32 +00:00
|
|
|
|
|
|
|
class ReadOnlyInline(models.Model):
|
|
|
|
name = models.CharField(max_length=100, help_text="Help text for ReadOnlyInline")
|
2015-07-22 14:43:21 +00:00
|
|
|
capo_famiglia = models.ForeignKey(CapoFamiglia, models.CASCADE)
|
2013-02-23 17:24:32 +00:00
|
|
|
|
|
|
|
|
2012-06-07 17:52:13 +00:00
|
|
|
# Models for #18433
|
|
|
|
|
2022-02-03 19:24:19 +00:00
|
|
|
|
2012-06-07 17:52:13 +00:00
|
|
|
class ParentModelWithCustomPk(models.Model):
|
|
|
|
my_own_pk = models.CharField(max_length=100, primary_key=True)
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
|
|
|
|
class ChildModel1(models.Model):
|
|
|
|
my_own_pk = models.CharField(max_length=100, primary_key=True)
|
|
|
|
name = models.CharField(max_length=100)
|
2015-07-22 14:43:21 +00:00
|
|
|
parent = models.ForeignKey(ParentModelWithCustomPk, models.CASCADE)
|
2012-06-07 17:52:13 +00:00
|
|
|
|
|
|
|
def get_absolute_url(self):
|
|
|
|
return "/child_model1/"
|
|
|
|
|
|
|
|
|
|
|
|
class ChildModel2(models.Model):
|
|
|
|
my_own_pk = models.CharField(max_length=100, primary_key=True)
|
|
|
|
name = models.CharField(max_length=100)
|
2015-07-22 14:43:21 +00:00
|
|
|
parent = models.ForeignKey(ParentModelWithCustomPk, models.CASCADE)
|
2012-06-07 17:52:13 +00:00
|
|
|
|
|
|
|
def get_absolute_url(self):
|
|
|
|
return "/child_model2/"
|
|
|
|
|
2013-05-30 17:48:10 +00:00
|
|
|
|
|
|
|
# Models for #19425
|
|
|
|
class BinaryTree(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
2015-07-22 14:43:21 +00:00
|
|
|
parent = models.ForeignKey("self", models.SET_NULL, null=True, blank=True)
|
2022-02-03 19:24:19 +00:00
|
|
|
|
2013-05-30 17:48:10 +00:00
|
|
|
|
2012-12-28 22:16:13 +00:00
|
|
|
# Models for #19524
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2012-12-28 22:16:13 +00:00
|
|
|
class LifeForm(models.Model):
|
|
|
|
pass
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2012-12-28 22:16:13 +00:00
|
|
|
class ExtraTerrestrial(LifeForm):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2012-12-28 22:16:13 +00:00
|
|
|
class Sighting(models.Model):
|
2015-07-22 14:43:21 +00:00
|
|
|
et = models.ForeignKey(ExtraTerrestrial, models.CASCADE)
|
2012-12-28 22:16:13 +00:00
|
|
|
place = models.CharField(max_length=100)
|
2012-06-07 17:52:13 +00:00
|
|
|
|
2013-10-07 16:30:02 +00:00
|
|
|
|
|
|
|
# Models for #18263
|
|
|
|
class SomeParentModel(models.Model):
|
|
|
|
name = models.CharField(max_length=1)
|
|
|
|
|
|
|
|
|
|
|
|
class SomeChildModel(models.Model):
|
|
|
|
name = models.CharField(max_length=1)
|
|
|
|
position = models.PositiveIntegerField()
|
2015-07-22 14:43:21 +00:00
|
|
|
parent = models.ForeignKey(SomeParentModel, models.CASCADE)
|
2018-03-08 22:19:02 +00:00
|
|
|
readonly_field = models.CharField(max_length=1)
|
2013-10-07 16:30:02 +00:00
|
|
|
|
2021-02-11 09:27:33 +00:00
|
|
|
|
|
|
|
# Models for #30231
|
|
|
|
class Course(models.Model):
|
|
|
|
name = models.CharField(max_length=128)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
|
|
|
|
class Class(models.Model):
|
|
|
|
person = models.ManyToManyField(Person, verbose_name="attendant")
|
|
|
|
course = models.ForeignKey(Course, on_delete=models.CASCADE)
|
|
|
|
|
|
|
|
|
|
|
|
class CourseProxy(Course):
|
|
|
|
class Meta:
|
|
|
|
proxy = True
|
|
|
|
|
|
|
|
|
|
|
|
class CourseProxy1(Course):
|
|
|
|
class Meta:
|
|
|
|
proxy = True
|
|
|
|
|
|
|
|
|
|
|
|
class CourseProxy2(Course):
|
|
|
|
class Meta:
|
|
|
|
proxy = True
|
|
|
|
|
|
|
|
|
Fixed #2879 -- Added support for the integration with Selenium and other in-browser testing frameworks. Also added the first Selenium tests for `contrib.admin`. Many thanks to everyone for their contributions and feedback: Mikeal Rogers, Dirk Datzert, mir, Simon G., Almad, Russell Keith-Magee, Denis Golomazov, devin, robertrv, andrewbadr, Idan Gazit, voidspace, Tom Christie, hjwp2, Adam Nelson, Jannis Leidel, Anssi Kääriäinen, Preston Holmes, Bruno Renié and Jacob Kaplan-Moss.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-22 08:33:58 +00:00
|
|
|
# Other models
|
2021-09-16 08:34:10 +00:00
|
|
|
class ShowInlineParent(models.Model):
|
|
|
|
show_inlines = models.BooleanField(default=False)
|
|
|
|
|
|
|
|
|
|
|
|
class ShowInlineChild(models.Model):
|
|
|
|
parent = models.ForeignKey(ShowInlineParent, on_delete=models.CASCADE)
|
Fixed #2879 -- Added support for the integration with Selenium and other in-browser testing frameworks. Also added the first Selenium tests for `contrib.admin`. Many thanks to everyone for their contributions and feedback: Mikeal Rogers, Dirk Datzert, mir, Simon G., Almad, Russell Keith-Magee, Denis Golomazov, devin, robertrv, andrewbadr, Idan Gazit, voidspace, Tom Christie, hjwp2, Adam Nelson, Jannis Leidel, Anssi Kääriäinen, Preston Holmes, Bruno Renié and Jacob Kaplan-Moss.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-22 08:33:58 +00:00
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
Fixed #2879 -- Added support for the integration with Selenium and other in-browser testing frameworks. Also added the first Selenium tests for `contrib.admin`. Many thanks to everyone for their contributions and feedback: Mikeal Rogers, Dirk Datzert, mir, Simon G., Almad, Russell Keith-Magee, Denis Golomazov, devin, robertrv, andrewbadr, Idan Gazit, voidspace, Tom Christie, hjwp2, Adam Nelson, Jannis Leidel, Anssi Kääriäinen, Preston Holmes, Bruno Renié and Jacob Kaplan-Moss.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-22 08:33:58 +00:00
|
|
|
class ProfileCollection(models.Model):
|
|
|
|
pass
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
Fixed #2879 -- Added support for the integration with Selenium and other in-browser testing frameworks. Also added the first Selenium tests for `contrib.admin`. Many thanks to everyone for their contributions and feedback: Mikeal Rogers, Dirk Datzert, mir, Simon G., Almad, Russell Keith-Magee, Denis Golomazov, devin, robertrv, andrewbadr, Idan Gazit, voidspace, Tom Christie, hjwp2, Adam Nelson, Jannis Leidel, Anssi Kääriäinen, Preston Holmes, Bruno Renié and Jacob Kaplan-Moss.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-22 08:33:58 +00:00
|
|
|
class Profile(models.Model):
|
2015-07-22 14:43:21 +00:00
|
|
|
collection = models.ForeignKey(
|
|
|
|
ProfileCollection, models.SET_NULL, blank=True, null=True
|
|
|
|
)
|
Fixed #2879 -- Added support for the integration with Selenium and other in-browser testing frameworks. Also added the first Selenium tests for `contrib.admin`. Many thanks to everyone for their contributions and feedback: Mikeal Rogers, Dirk Datzert, mir, Simon G., Almad, Russell Keith-Magee, Denis Golomazov, devin, robertrv, andrewbadr, Idan Gazit, voidspace, Tom Christie, hjwp2, Adam Nelson, Jannis Leidel, Anssi Kääriäinen, Preston Holmes, Bruno Renié and Jacob Kaplan-Moss.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-22 08:33:58 +00:00
|
|
|
first_name = models.CharField(max_length=100)
|
2012-06-07 16:08:47 +00:00
|
|
|
last_name = models.CharField(max_length=100)
|
2021-09-08 09:19:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
class VerboseNameProfile(Profile):
|
|
|
|
class Meta:
|
|
|
|
verbose_name = "Model with verbose name only"
|
|
|
|
|
|
|
|
|
|
|
|
class VerboseNamePluralProfile(Profile):
|
|
|
|
class Meta:
|
|
|
|
verbose_name_plural = "Model with verbose name plural only"
|
|
|
|
|
|
|
|
|
|
|
|
class BothVerboseNameProfile(Profile):
|
|
|
|
class Meta:
|
|
|
|
verbose_name = "Model with both - name"
|
|
|
|
verbose_name_plural = "Model with both - plural name"
|
2024-04-21 18:06:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
class UUIDParent(models.Model):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class UUIDChild(models.Model):
|
|
|
|
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
|
|
|
title = models.CharField(max_length=128)
|
|
|
|
parent = models.ForeignKey(UUIDParent, on_delete=models.CASCADE)
|