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 
table, but with one side being a 1to1.

ISTM that the sugar to make this behave wouldn't be much greater than that 
used for MTI, but I say that having not delved yet, so... what would I 
know? :)


On Sunday, June 16, 2013 3:04:36 AM UTC+10, Carl Meyer wrote:
> Hi Amir,
> On Jun 15, 2013, at 9:11 AM, Amir Rachum <nur...@gmail.com <javascript:>> 
> 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 use this relationship, and would love some feedback
> http://blog.amir.rachum.com/post/53019452363/a-case-for-a-onetomany-relationship-in-django
> The strongest reason not to do this is that it breaks the correspondence 
> between model fields and database columns. If you added a new OneToMany 
> field on Band pointing to Musician, suddenly the (unmodified) Musician 
> model's db table would require a schema migration, while the Band table 
> would remain unchanged. (Yes, ManyToManyField already sort of breaks this 
> correspondence, but only in that it causes a new table to be created in the 
> same app where you added the field. It never requires a schema migration 
> for an untouched model class, possibly in a different app, which is much 
> worse.)
> I think this downside alone is enough to kill the proposal for Django 
> core, especially considering the rationale in favor isn't that strong; it's 
> just a new way to spell the exact equivalent of a ForeignKey.
> That said, I'm pretty sure you could code this up outside of core, if 
> you'd like to experiment with it.
> Carl

You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to