mirror of
https://github.com/django/django.git
synced 2025-11-02 04:48:33 +00:00
Fixed #12749 -- Corrected a problem with validation of inline primary keys. Thanks to Chris.Wesseling@cwi.nl for the report, and nessita for the test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13034 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
b031fa2376
commit
dd07c23545
4 changed files with 55 additions and 9 deletions
|
|
@ -102,6 +102,29 @@ admin.site.register(Holder2, HolderAdmin, inlines=[InnerInline2])
|
|||
# only Inline media
|
||||
admin.site.register(Holder3, inlines=[InnerInline3])
|
||||
|
||||
# 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)
|
||||
|
||||
class InlineWeakness(admin.TabularInline):
|
||||
model = ShoppingWeakness
|
||||
extra = 1
|
||||
|
||||
admin.site.register(Fashionista, inlines=[InlineWeakness])
|
||||
|
||||
|
||||
__test__ = {'API_TESTS': """
|
||||
|
||||
# Regression test for #9362
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue