mirror of
https://github.com/django/django.git
synced 2025-10-25 22:56:12 +00:00
Fixed #13987 -- Ensure that the primary key is set correctly for all models that have concrete-abstract-concrete inheritance, not just the first model. Thanks to Aramgutang for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15498 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -123,6 +123,12 @@ class Options(object):
|
||||
# Promote the first parent link in lieu of adding yet another
|
||||
# field.
|
||||
field = self.parents.value_for_index(0)
|
||||
# Look for a local field with the same name as the
|
||||
# first parent link. If a local field has already been
|
||||
# created, use it instead of promoting the parent
|
||||
already_created = [fld for fld in self.local_fields if fld.name == field.name]
|
||||
if already_created:
|
||||
field = already_created[0]
|
||||
field.primary_key = True
|
||||
self.setup_pk(field)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user