[Solved] Django How can I update relational model from its relative model

nogabemist Asks: Django How can I update relational model from its relative model
I have two models that are

class Personal (models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=255)
lastname = models.CharField(max_length=255)
user_roles_id = models.ForeignKey(User_Role, on_delete=models.CASCADE)
hospitals_id = models.ForeignKey(Hospital, on_delete=models.CASCADE)
hospital_local_users_id = models.OneToOneField(
    Hospital_Local_User, on_delete=models.CASCADE)
isDeleted = models.BooleanField(default=False)

class Hospital_Local_User(models.Model):
    id = models.AutoField(primary_key=True)
    email = models.CharField(max_length=320)
    password = models.CharField(max_length=45)
    phone = models.CharField(max_length=45)

I can change Person model with

selectedUser = Personal.objects.get(id=userId) selectedUser.name = name

but I cannot change mail and phone with belove code.

selectedUser.hospital_local_users_id.email = email

I can reach email with above code but I cannot update it. I couldn’t figure out how to solve this issue.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.