Updating django database

2018-05-29 Thread Albin Antony
Hello guys, Sorry about the above no subject mail I am getting a json string(json_string) from frontend. How can we update the django database in views.py. Below is my models.py. models.py class Patient(models.Model): patient_id = models.CharField(primary_key=True, max_length=200) patient

Re: Updating django database

2018-06-02 Thread Albin Antony
age. > 2 Validate as necessary > 3 Update : > for field, value in data.items(): > setattr(instance, field, value) > >instance.save() > > Assuming that instances is the Patient record to be updated. > > I hope this helps.

Re: Updating django database

2018-06-02 Thread Albin Antony
Can the first be done if there is a relation between the models? On Sat, Jun 2, 2018 at 7:49 PM, Melvyn Sopacua wrote: > On zaterdag 2 juni 2018 15:12:08 CEST Albin Antony wrote: > > For updating multiple models at the same time, Should we create multiple > > instances? >