Hi try: class Model4(models.Model): model3=ForeignKey(Model3, blank=true, null=true)
Regards Martin On 13 Apr., 04:14, Jurassic <ybi...@gmail.com> wrote: > Guys, can you please share your approach to handle complex models > where each model has a ForeignKey to another? I am trying to build a > flex app using RemoteObject and [RemoteClass(alias=...)] flex feature > to map flex VO to django data models. > Here's an approximate scenario I'm working with: > --------------- > class Model1(models.Model): > ... > class Model2(models.Model): > model1=ForeignKey(Model1) > ... > class Model3(models.Model): > model2=ForeignKey(Model2) > ... > class Model4(models.Model): > model3=ForeignKey(Model3) > ... > -------------- > What do I do to save a single object of Model4? Django complains if > "model3" field is null, so I have to have a Model3 object assigned to > it. Same with Model3 - "model2" field must be populated, so far so > forth. So, for saving one object I have to push all related objects > from flex to django. Is there any way around this? All that django > needs is just an ID of the related model, not the whole darn object. > How do you guys deal with this? > > Thank you much in advance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.