Hi I've submitted a patch for this bug that I'd like to have considered for
some trunk action... I can't take the credit for all the work on this, but
it seems I'm taking the initiative to get it resolved.
I really only had one question about a particular change that was needed in
order for the .values() query to work with reverse one-to-one (e.g.,
User.objects.values('username', 'userprofile__zip') ) . It looks like
mtredinnick wrote the original code for this that was modified. The change
was fairly simpe, In the setup_joins function in db/models/sql/query.py:
---
raise FieldError("Cannot resolve keyword %r into field. "
"Choices are: %s" % (name, ", ".join(names)))
- if not allow_many and (m2m or not direct):
+ if not allow_many and m2m:
for alias in joins:
self.unref_alias(alias)
raise MultiJoin(pos + 1)
---
Looking at the original code, I'm not sure why "indirect" fields were not
allowed if they weren't many-to-many relationships. This is basically what
was keeping the reverse one-to-one lookups from working. I'm not 100% sure
of the consequences of this change, but all model tests seemed to pass with
this change.
thoughts?
link to original ticket: http://code.djangoproject.com/ticket/7270
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---