Re: Insert data into multiple models when doing POST method

2018-05-21 Thread Daniel Germano Travieso
Hello! ​As my initial understanding, you are attempting to use some sort of Django REST Framework. Check the django-rest-framework documentation for some insights: http://www.django-rest-framework.org/api-guide/serializers/ You will need to overwrite the .create method of the Patient Model and th

Insert data into multiple models when doing POST method

2018-05-21 Thread thiagarajan.kpt
Hi, I have two models (Patients and PatientAddress). I want to create a new patient using POST method and data should be inserted in Patient and PatientAddress tables. But the data is inserted only into Patients table and not in PatientAddress table. When I POST a new patient with Address then

Re: Insert data into multiple models

2017-10-23 Thread mohammad k
https://docs.djangoproject.com/en/1.11/topics/signals/ On Mon, Oct 23, 2017 at 8:22 PM, mohammad k wrote: > you can use model signals > > > On Mon, Oct 23, 2017 at 4:15 PM, Mukul Mantosh > wrote: > >> I have two models (User and Employee). I want to create a new user and >> make a reference be

Re: Insert data into multiple models

2017-10-23 Thread mohammad k
you can use model signals On Mon, Oct 23, 2017 at 4:15 PM, Mukul Mantosh wrote: > I have two models (User and Employee). I want to create a new user and > make a reference between employee and user. > > > *User Table* > 1. Name > 2. E-Mail > 3. Date of Birth > 4. Contact Number > > > *Employee

Insert data into multiple models

2017-10-23 Thread Mukul Mantosh
I have two models (User and Employee). I want to create a new user and make a reference between employee and user. *User Table* 1. Name 2. E-Mail 3. Date of Birth 4. Contact Number *Employee Table* 1. EmployeeID 2. Address 3. Country 4. Profile Photo 5. *user_id* *Problem Statement: *When