Correct, refresh_from_db() is expected to only update the current model, not traverse to others linking it (which could be *many*). You'd want m.refresh_from_db() to refresh the fact that the user field on m has changed.
On Sun, 2 Sep 2018 at 20:40, Ian Foote <i...@feete.org> wrote: > On 02/09/18 19:59, Shivam Jindal wrote: > > Hi Lan, > > > > *m.user.refresh_from_db()* is sam as > > > > *u = m.user* > > *u.refresh_from_db()* > > > > So If I am refreshing u, it should update all relationship and property > > of *u*(including reverse relation). Should It not? > > > > Hi Shivam, > > As far as I can tell, u.refresh_from_db() only cares about making sure > u's state is in sync with the database. It doesn't care about the state > of any related objects, like m. > > I suspect that cascading the sync to related objects would be difficult > to get right and might be unexpected behaviour to other users. I'm still > not convinced this is a bug and even if it is, I think it would require > a deprecation cycle to change, so I don't think it would be worth it. > Just calling m.refresh_from_db() instead seems sufficient to me. > > Ian > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To post to this group, send email to django-developers@googlegroups.com. > Visit this group at https://groups.google.com/group/django-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/cdd0e68f-64e8-ef1c-5022-9ecab4ba604e%40feete.org > . > For more options, visit https://groups.google.com/d/optout. > -- Adam -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMyDDM3Z%2BSVESOxi%3DKYh9CE2TNzVreT2S%2BXP3uhdQrje%3DHkjew%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.