#24289: ForeignKey is many_to_one, not one_to_many
-------------------------------------+-------------------------------------
               Reporter:  akaariai   |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  1.8alpha1
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 It seems we have mixed up the naming of many_to_one and one_to_many. For
 example these references point out that ForeignKey is many_to_one:
 
http://www-01.ibm.com/support/knowledgecenter/SSEPGG_8.2.0/com.ibm.db2.udb.doc/admin/c0004733.htm,
 https://docs.djangoproject.com/en/1.7/topics/db/examples/many_to_one/.

 But in Django, ForeignKey is one_to_many.

 I'm not going to mark this as accepted, as I always get confused with
 many-to-one and one-to-many. So, please do triage this carefully!

 If at all possible I think we should use something that is less easy to
 get mixed up. I never recall how these terms should be interpreted, and I
 guess I am not alone here. Some ideas:
   - Just is_multivalued flag: Check if field is one to many: "not
 field.is_multivalued and field.rel.is_multivalued"
   - local_multivalued and remote_multivalued flags

 My experience from ORM work is that the interesting thing to check is if
 the relation can have multiple values on the remote side. The local multi-
 valuedness isn't usually that interesting (although it might be in other
 contexts).

--
Ticket URL: <https://code.djangoproject.com/ticket/24289>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.f9a7dd16c6cdd9cd7c6f669eba6252ca%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to