Hi,
Using Django 1.8.3, I have 2 models, both unmanaged (remote DB managed by 
another system), with something similar to that:

class Parent(Model):
... some fields...

class Child(Model):
id = OneToOneField(primary_key=True, parent_link=True)
... some other fields ...

Notes:

   1. Parent is not abstract.
   2. Each of the models have their own real tables.
   3. Not using model inheritance because I want the parent_link field to 
   be called "id" (as the db column), and Django doesn't allow hiding fields 
   (with the same name).

Given all that, using select_related('id') in a Child QuerySet doesn't work 
(no exception but the Parent fields aren't fetched in the same DB query).
In order to workaround the issue, I removed the parent_link attribute (note 
that as the tables are unmanaged, this attribute, and others, exist merely 
as documentation, so I can remove it).
Without the parent_link attribute, the Child fields are indeed fetched in 
the same DB query, as expected from select_related().

Is it a bug in Django or something I'm missing?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/df6f5ea8-3eae-4595-a352-b1ce07c3bc4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to