Fixed #15907 -- Fixed another conflict between the ModelForm exclude and the GenericInline. Thanks, leonelfreire and prestontimmons.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16603 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2011-08-12 14:14:58 +00:00
parent 3d027b72eb
commit 386b12c1c6
4 changed files with 98 additions and 26 deletions

View file

@ -5,6 +5,8 @@ from django.contrib.contenttypes.models import ContentType
class Episode(models.Model):
name = models.CharField(max_length=100)
length = models.CharField(max_length=100, blank=True)
author = models.CharField(max_length=100, blank=True)
class Media(models.Model):
"""
@ -14,6 +16,8 @@ class Media(models.Model):
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey()
url = models.URLField(verify_exists=False)
description = models.CharField(max_length=100, blank=True)
keywords = models.CharField(max_length=100, blank=True)
def __unicode__(self):
return self.url
@ -59,18 +63,6 @@ class MediaMaxNumInline(generic.GenericTabularInline):
admin.site.register(EpisodeMaxNum, inlines=[MediaMaxNumInline])
#
# Generic inline with exclude
#
class EpisodeExclude(Episode):
pass
class MediaExcludeInline(generic.GenericTabularInline):
model = Media
exclude = ['url']
admin.site.register(EpisodeExclude, inlines=[MediaExcludeInline])
#
# Generic inline with unique_together