#8719: KeyError on save of model with inline-edited ForeignKey with non-standard
primary key
--------------------------------------+-------------------------------------
Reporter: jonloyens | Owner: nobody
Status: new | Milestone:
Component: Admin interface | Version: SVN
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by kmtracey):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Interesting. This case I know did once work, because all my models have
non-standard naming and I was once able to save models with inline-edited
objects. I've isolated when this failure was introduced to [8528].
Specifically I'm sure it's the change from `if
self.model._meta.has_auto_field:` to `if
self.model._meta.pk.auto_created:` in `add_fields`. For the old way non-
standard-named PK fields were getting added, now they are not.
It is quite similar to #8695 in that the problem is the PK value is not
added to the form data. However, the #8695 case was not working before
[8528] either. In that case the PK field is not an auto field at all.
It seems `add_fields` needs to consider more cases where the PK field
needs to be hidden in the form.
[Oddly enough the #8694 was also introduced by [8528], however it is a
different part of [8528] that causes the problem in #8694.)
--
Ticket URL: <http://code.djangoproject.com/ticket/8719#comment:1>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---