Re: Adding a OneToMany Relationship to Django

2013-07-10 Thread Loic Bistuer
It's less efficient because of the extra table but that's pretty much the only option when you need a FK on a model that you can't edit. GFK are not exactly efficient either, yet most will agree that it's sometime the best option to a given problem. I agree that the distinction between FK and

Re: Adding a OneToMany Relationship to Django

2013-07-10 Thread Carl Meyer
On 07/10/2013 05:40 PM, Carl Meyer wrote: >> I'm not sure I completely agree with Carl that is breaks correspondence >> -- after all, m2m fields don't correlate to a field, either. However, in >> the absence of a built-in migrations framework, I suspect a O2M field >> would be a pretty efficient

Re: Adding a OneToMany Relationship to Django

2013-07-10 Thread Carl Meyer
Hi Russ, On 07/10/2013 05:33 PM, Russell Keith-Magee wrote: > On Wed, Jul 10, 2013 at 4:20 PM, Curtis Maloney > > wrote: > > I've seen enough people in #django suffering because they need a > FKey on a table they simply can't

Re: Adding a OneToMany Relationship to Django

2013-07-10 Thread Curtis Maloney
I've seen enough people in #django suffering because they need a FKey on a table they simply can't alter -- be it because it's in a 3rd party app, or simply a table their DBA won't permit them to alter, or what have you. In the end they wind up having to create the equivalent of a m2m through

Re: Adding a OneToMany Relationship to Django

2013-07-10 Thread Loic Bistuer
I totally agree that we can't have a field on one model that modifies the underlying table of another model, especially with migrations in mind. That said, I see value in a OneToManyField backed by a M2M with a unique constraint on one side. This is particularly useful when you don't want to

Re: Adding a OneToMany Relationship to Django

2013-06-15 Thread Carl Meyer
Hi Amir, On Jun 15, 2013, at 9:11 AM, Amir Rachum wrote: > I'm not sure if this feature was discussed before (I've seen some mentions of > it when searching this group, but nothing definitive). > I have written a blog post regarding the reasons (and the suggested syntax) > to

Re: Adding a OneToMany Relationship to Django

2013-06-15 Thread Tomas Ehrlich
Hello Amir, you've mentioned only definiton of model. Yes, it looks interesting and definitely more readable. But definition of model is just the begining. At database level, these models would be represented in the same way. (No difference) Working with models would be similar or even the same

Re: Adding a OneToMany Relationship to Django

2013-06-15 Thread Luke Sneeringer
It seems to me that "there should be one--and preferably only one--way to do it." This would entail having two ways. Sometimes that makes sense if they're distinct enough things conceptually, but personally I don't see that case. Best Regards, Luke Sneeringer Sent from my iPhone. Forgive us