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(). Since b will be refreshed in-place, a.b will point to an updated instance of b, without any special handling. For consistency, the cached value of b.a could be cleared as well. However, it doesn't really depend on b itself. It only depends on the PK, and PKs are immutable (changing the PK makes a copy). If it turns out to be easier not to clear that value, I'll happily leave this decision to the person who implements the patch! -- Aymeric. -- 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.
