I'm trying to use/compare some django features with yii.
In django i can do something like:
Model1(models.Model): name Model2(Model1): phone
When django sync with database tables model1 and model2 are created:
model1 ------- id name model2 ------------- model1_ptr_id phone
To fill the two tables i create a form based on Model2. My template show the field name and phone and django take care to post name to the model1 and phone to the model 2 and create the relation.
2) (not related with django now)
How to build a form to handle a one to many relation ? Example: i need to insert an author and some books in the same post. I don't know how many books i will fill, so i will need some type of inline form and ajax to add new lines. In this example:
2.1) If i’m adding authors and books, does yii generate the author id and pass it to the books ?
2.2) If i’m editing books for an author, how yii handle edited and inserted books to not duplicate books when posting ?
How to do this with yii ?