I'm wondering, what is a standard way of updating multiple fields which includes related fields of an instance of a model in django? ...
Class User(models.Model):
id = models.CharField()
name = models.CharField()
dob = models.CharField()
Class Appointment(models.Model):
user = models.ForeignKey(User)
app_id = models.CharField()
time = models.DateTimeField()
status = models.CharField()
To update multiple fields in appointment model I could just do
dict ={
"app_id": "123",
"time": "2012-01-01 10:30",
"status": "Open"
}
Appointment.objects.filter(app_id=123).update(dict)
Is there a way to update the related model?
How could I do an update on Appointment model and User Model?
Case:
dict ={
"name": "foo",
"app_id": "123",
"time": "2012-01-01 10:30",
"status": "Open"
}