#24289: Is usage of many_to_one and one_to_many terms confusing for relation 
flags?
-------------------------------------+-------------------------------------
     Reporter:  akaariai             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.8alpha1
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by akaariai):

 I don't think reversing the many_to_one and one_to_many definitions will
 help. The terms are confusing, no matter which way they are used, and I
 believe the terms are used the correct way (as in, the most often seen
 definition)

 I see two ways forward:
   - Keep the flags as is. Maybe add a bit more documentation somewhere
 that tell explicitly what these flags mean in Django.
   - Use some other flags for relations. A possibility is local_multiple
 and remote_multiple flags. These flags would tell if a single object can
 have multiple objects. remote_multiple tells that the local object can
 have multiple objects on the remote side. local_multiple is the opposite:
 can a single remote object have multiple objects on the local side. Still
 a bit confusing, but I think these are easier to recall correctly.

 A bonus of the second approach is that I believe the local_multiple and
 remote_multiple properties are what we are most often interested about: we
 can select_related if the relation is remote_multiple=False. We need to
 use subqueries with .exclude() when the relation is remote_multiple=True.
 The widget in forms is SelectMultiple when remote_multiple=True.

 We could also use just a has_many flag, but then it's hard to say if an
 ArrayField should have has_many set. The remote_multiple is better, as it
 is explicitly about relations.

 We could even have both n_to_n flags, and the local_multiple and
 remote_multiple flags. We could use the checks framework to warn if the
 flags aren't defined in a consistent way.

--
Ticket URL: <https://code.djangoproject.com/ticket/24289#comment:13>
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/066.a385192aab8a51486c75e0259e0bc446%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to