mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user