Trying to use some django features with yii

Hi guys.

I'm trying to use/compare some django features with yii.

1)

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 ?

Ty.

How to do this with yii ?

This docs topic seems to be the way to do the one to many relation form.

Now, i just need to know about 1, 2.1 and 2.2 questions. I will give to google another try. :)

An one-to-one relation in my models and this tip can solve the problem with the model inheritance.

for the 2.1 and 2.2 i think i need to test (or someone can point me to some example of master/detail using yii ? ) :D