On Sunday 12 May 2013, Aymeric Augustin wrote:
> On 12 mai 2013, at 10:24, Shai Berger <[email protected]> wrote:
> > Relatedly, we now cache back-references of 1-to-1 relations on the
> > instance
> 
> Django has cached them for a long time. It's just a bit more efficient and
> deterministic as of Django 1.5. :)
> 
> > those should probably be updated (on remote objects!) too, or else some
> > serious inconsistencies may be created (when the _id field changes, that
> > is).
> 
> Let's say model A has a one-to-one relation to model B — ie. a has a b_id.
> The reverse relation is b.a, and you're discussing b.refresh().
> 

No, I mean:

aa= A.objects.get(...)
bb= aa.b
(some other operation, changing aa.b_id in the database)
aa.refresh()

Now -- unless we do something about it -- bb.a is still aa, but aa.b is not bb 
and not even equal to it; thus, "bb.a.b == bb" is false, which currently 
cannot happen without serious meddling if I'm not mistaken.

Shai.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to