1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[1.6.x] Fixed #23754 -- Always allowed reference to the primary key in the admin

This change allows dynamically created inlines "Add related" button to work
correcly as long as their associated foreign key is pointing to the primary
key of the related model.

Thanks to amorce for the report, Julien Phalip for the initial patch,
and Collin Anderson for the review.

Backport of f9c4e14aec from master
This commit is contained in:
Simon Charette
2014-11-16 16:42:09 +01:00
committed by Tim Graham
parent c3a40af6ec
commit 2fd16232b1
8 changed files with 64 additions and 22 deletions

View File

@@ -31,7 +31,7 @@ from .models import (Article, Chapter, Account, Media, Child, Parent, Picture,
AdminOrderedCallable, Report, Color2, UnorderedObject, MainPrepopulated,
RelatedPrepopulated, UndeletableObject, UserMessenger, Simple, Choice,
ShortMessage, Telegram, ReferencedByParent, ChildOfReferer, M2MReference,
ReferencedByInline, InlineReference, InlineReferer, Ingredient)
ReferencedByInline, InlineReference, InlineReferer, Recipe, Ingredient, NotReferenced)
def callable_year(dt_value):
@@ -756,7 +756,6 @@ site.register(UnorderedObject, UnorderedObjectAdmin)
site.register(UndeletableObject, UndeletableObjectAdmin)
site.register(ReferencedByParent)
site.register(ChildOfReferer)
site.register(M2MReference)
site.register(ReferencedByInline)
site.register(InlineReferer, InlineRefererAdmin)
@@ -789,7 +788,9 @@ site.register(Color2, CustomTemplateFilterColorAdmin)
site.register(Simple, AttributeErrorRaisingAdmin)
site.register(UserMessenger, MessageTestingAdmin)
site.register(Choice, ChoiceList)
site.register(Recipe)
site.register(Ingredient)
site.register(NotReferenced)
# Register core models we need in our tests
from django.contrib.auth.models import User, Group