Monday, October 23, 2017

Re: Insert data into multiple models


On Mon, Oct 23, 2017 at 8:22 PM, mohammad k <k2527806@gmail.com> wrote:
you can use model signals 


On Mon, Oct 23, 2017 at 4:15 PM, Mukul Mantosh <mukulmantosh91@gmail.com> 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 Table
1. EmployeeID
2. Address 
3. Country
4. Profile Photo
5. user_id

Problem Statement:  When i create a new user then automatically it should create a new record in employee table with user_id referencing to the user table and without writing two SQL Statements and should also follow the database transaction property(ACID).


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/124695ae-e1f1-4252-8bbb-272cb438243b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACOk0TzFTG128GL-3dxpKRkyS61F6e4euxgusm4MimXtJw_FEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment