On Fri, 2009-08-07 at 00:30 -0700, Jan Ostrochovsky wrote: > Thank you, Malcolm. > > In fact, our current design was, as you recommended: > > Subject ---one-to-one-null-false--- Address ---one-to-one-null-true--- > Payment (Invoice) > > I want to use generic views and to join Subject+Address in the same > form, and model inheritance seemed to me as most straightforward > solution for this need, but as you do not recommend it,
Bear in mind that there might be somebody who gives stricter recommendations on not abusing model inheritance around here, but I'm not sure who they would be. I very much view it as a Python equivalent (with some abstraction leakage from DB -> Python), but my view isn't universally held. In this case, though, what you're asking for isn't possible in the way the code is implemented, so it's not just a matter of preference. > I will look > for another solution... e.g. form inheritance, as I found it here > http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#form-inheritance > or here http://www.djangosnippets.org/snippets/703/. Hmm ... if you're doing this for the form result and you aren't intermixing the fields from Subject and Address (or even if you are), you might be better served by still making each on its own ModelForm and just passing both into the template. Then layout both Django forms inside a single HTML form element. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 -~----------~----~----~----~------~----~------~--~---