#25672: Related ManyToMany fields with custom intermediary model should not 
disable
remove method.
-------------------------------------+-------------------------------------
     Reporter:  Antwan86             |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  1.8
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  manytomany related   |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by bmispelon):

 I had a chat with Russ and he raised the following point. Consider a
 custome through table that (unlike the auto-generated one) doesn't enforce
 unicity on the `(model1, model2)` pair (which is a valid usecase).

 Something like this:
 {{{#!python
 class Pizza(models.Model):
     name = models.CharField(max_length=50)


 class Customer(models.Model):
     name = models.CharField(max_length=50)
     orders = models.ManyToManyField('Pizza', through='Order')


 class Order(models.Model):
     pizza = models.ForeignKey('Pizza')
     customer = models.ForeignKey('Customer')
     ordered_on = models.DateTimeField(default=timezone.now)
 }}}

 Doing `some_customer.orders.remove(some_pizza)` doesn't give enough
 information as to which `Order` instance should actually be deleted.

 It seems to me that we should just better document the reason behind this,
 considering it's not exactly obvious.

--
Ticket URL: <https://code.djangoproject.com/ticket/25672#comment:2>
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.03bb2fe6b387cbbb08d00363886f6316%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to