I have the following model

class Member(models.Model):
    user = models.OneToOneField(User, null=True, blank=True)

*Operation sequence*

m = Member.objects.get(id=4) # This objects has attached user
m.user # Print user objects successfully
m1 = Member.objects.get(id=4) # Fetch same object from db
m1.user = None
m1.save() # Remove user object from above member

*m.user.refresh_from_db()*
*m.user.member* # It is printing the member object which was linked
previously, but the user object should not have attached member object
because the relationship should had been updated by calling
*refresh_from_db()*

-- 
*Shivam Jindal*
*Software Developer* | *Josh Technology Group*
shivam.jin...@joshtechnololygroup.com

-- 
CONFIDENTIALITY
 NOTICE: The information contained in this e-mail is for 
the intended 
recipient(s) alone. It may contain privileged and 
confidential 
information that is exempt from disclosure under applicable 
law. If you 
have received this email in error, please notify the sender of 
the error
 and delete this message immediately.

-- 
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/CAOU9VRa477v3_pkPPYvJXa%2B47zTkbjt1xdLRjbZ9%2BXWtAYb6rQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to