Hi Russ,

On 07/10/2013 05:33 PM, Russell Keith-Magee wrote:
> On Wed, Jul 10, 2013 at 4:20 PM, Curtis Maloney
> <[email protected] <mailto:[email protected]>> wrote:
> 
>     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? :)
> 
> 
> This is a use case I've seen many times in the past -- most commonly
> with the User model, but with others as well. To that end, I have a
> certain sympathy for the request.
> 
> 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 foot-gun for newcomers.

I mentioned the m2m case in my email. The more basic invariant (that is
currently respected by all built-in fields) is "when you put a field on
a model, it creates or changes db tables in that model's app, not some
other app."

What's being requested here is essentially an ORM variant of
monkeypatching third-party apps. While I accept that monkeypatching
third-party code is sometimes pragmatically the best of bad options, I
don't think it's a technique that we should be blessing with a built-in
first-class field type.

Carl

> That said - I agree that it should be possible to implement this
> external to core. There's a certain amount of "here be dragons" in the
> django.db.models.fields.related code, but it should be relatively
> straightforward to implement the reverse of a ForeignKey. If someone is
> interested in this, I'd rather see it proven as an external tool before
> we add it to core.

For sure.

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 [email protected].
To post to this group, send email to [email protected].
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