mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #14670 -- Made GenericTabularInline aware of changes made in r13708. Thanks, gregmuellegger.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14555 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
3b29fe353b
commit
109f42a981
3 changed files with 11 additions and 2 deletions
|
@ -76,11 +76,15 @@ admin.site.register(EpisodeExclude, inlines=[MediaExcludeInline])
|
|||
# Generic inline with unique_together
|
||||
#
|
||||
|
||||
class Category(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
|
||||
class PhoneNumber(models.Model):
|
||||
content_type = models.ForeignKey(ContentType)
|
||||
object_id = models.PositiveIntegerField()
|
||||
content_object = generic.GenericForeignKey('content_type', 'object_id')
|
||||
phone_number = models.CharField(max_length=30)
|
||||
category = models.ForeignKey(Category, null=True, blank=True)
|
||||
|
||||
class Meta:
|
||||
unique_together = (('content_type', 'object_id', 'phone_number',),)
|
||||
|
@ -93,6 +97,7 @@ class PhoneNumberInline(generic.GenericTabularInline):
|
|||
model = PhoneNumber
|
||||
|
||||
admin.site.register(Contact, inlines=[PhoneNumberInline])
|
||||
admin.site.register(Category)
|
||||
|
||||
#
|
||||
# Generic inline with can_delete=False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue