Re: Same form saving to related models

2017-06-10 Thread Melvyn Sopacua
On Saturday 10 June 2017 15:42:50 Elorm Koku wrote: > Melvin thanks, actually my models are simplified...the switch of fk > was a way of trying to use it at d front end so that I could provide > an id to link em up...unfortunately I can't go around it since an > instance of the model is not easily

Re: Same form saving to related models

2017-06-10 Thread yingi keme
Yea exactly. A many to many relationship is the best approach on this. Elorm you should try many to many relationship if you are not completely satisfied. Thanks Melvyn Yingi Kem > On 10 Jun 2017, at 3:38 PM, Melvyn Sopacua wrote: > > On Saturday 10 June 2017 13:20:11 yingi keme wrote: >

Re: Same form saving to related models

2017-06-10 Thread Elorm Koku
Melvin thanks, actually my models are simplified...the switch of fk was a way of trying to use it at d front end so that I could provide an id to link em up...unfortunately I can't go around it since an instance of the model is not easily accessible cos its a new object not saved yet...I thought of

Re: Same form saving to related models

2017-06-10 Thread Melvyn Sopacua
On Saturday 10 June 2017 13:20:11 yingi keme wrote: > The variable for foreign key is supposed to be declared under Student > model because parents can typically have more than one kid in a > school isnt it? And typically, students can have more then one parent. So either rename your Parent mod

Re: Same form saving to related models

2017-06-10 Thread Elorm Koku
Thanks yingi, u saved a life :) On Jun 10, 2017 12:20 PM, "yingi keme" wrote: > Well. What you are trying to do is a bit awkward, but i will try my best > to answer. > > The variable for foreign key is supposed to be declared under Student > model because parents can typically have more than one

Re: Same form saving to related models

2017-06-10 Thread yingi keme
Well. What you are trying to do is a bit awkward, but i will try my best to answer. The variable for foreign key is supposed to be declared under Student model because parents can typically have more than one kid in a school isnt it? You should try and understand relational database. Now this i

Re: Same form saving to related models

2017-06-09 Thread Elorm Koku
No luck for me? On Jun 9, 2017 4:43 AM, "Elorm Koku" wrote: > Hi guys, > I need a means to save these 2 models related by FK but I want to use one > form. I searched but I jus can't do it. > > class Student(models.Model): > ... > > class Parent(models.Model): > > child = models.Fore

Same form saving to related models

2017-06-08 Thread Elorm Koku
Hi guys, I need a means to save these 2 models related by FK but I want to use one form. I searched but I jus can't do it. class Student(models.Model): ... class Parent(models.Model): child = models.ForeignKey(Student) All I need is a form I can use to every student and their paren