#10808: Multiple inheritance (model-based) broken for __init__ of common fields
in
diamond inheritance
---------------------------------------------------+------------------------
Reporter: mikemintz | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: SVN
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Changes (by mikemintz):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
It looks like the reason this is happening is in the "for field in
fields_iter:" loop around line 224 for db/models/base.py. We iterate
through the fields in order, but "name" is defined twice in the fields, so
the second time it's reached, the argument has been popped from kwargs,
and we set it back to field.get_default().
This could be easily solved by having a local set of "set_fields" in
!__init!__. Each time we call setattr on field.attname, we add
field.attname to the set (and don't call setattr on it again if it's been
set already).
If this sounds like a reasonable solution, I can write a patch.
--
Ticket URL: <http://code.djangoproject.com/ticket/10808#comment:1>
Django <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
-~----------~----~----~----~------~----~------~--~---