Re: [Django] #25672: Related ManyToMany fields with custom intermediary model should not disable remove method.

2015-11-13 Thread Django
#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: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
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.


Re: [Django] #25672: Related ManyToMany fields with custom intermediary model should not disable remove method.

2015-11-10 Thread Django
#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
-+-
Changes (by timgraham):

 * Attachment "25672.diff" added.


--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.a0b0bfab68ab6eb2304ee3dc338c5563%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25672: Related ManyToMany fields with custom intermediary model should not disable remove method.

2015-11-10 Thread Django
#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
-+-
Changes (by timgraham):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Russ called out the `remove()` method in ticket:6095#comment:33 but I fail
 to understand that reasoning as well. There doesn't seem to be any problem
 modify the relevant tests (patch attached - would need doc updates too).
 Are we missing something?

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.7f23a860fb662cfbdd821d738d0d78ee%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #25672: Related ManyToMany fields with custom intermediary model should not disable remove method.

2015-11-03 Thread Django
#25672: Related ManyToMany fields with custom intermediary model should not 
disable
remove method.
--+
 Reporter:  Antwan86  |  Owner:  nobody
 Type:  Cleanup/optimization  | Status:  new
Component:  Database layer (models, ORM)  |Version:  1.8
 Severity:  Normal|   Keywords:  manytomany
  |  related
 Triage Stage:  Unreviewed|  Has patch:  0
Easy pickings:  0 |  UI/UX:  0
--+
 It is currently impossible to add or create related item to a many-to-many
 relationship with custom intermediary model, with reason, as the custom
 model extra fields won't be populated.
 [https://github.com/django/django/blob/1.8.5/docs/topics/db/models.txt#L508
 This is documented and explained].

 However, it is also not possible to remove related items from the
 collection, and the only reason given in the doc is : ''"The remove()
 method is disabled for similar reasons"''.

 I've try to find a justification for this though the code/docs/history but
 I couldn't and this seems unjustified for me.
 All the informations needed to remove the relation are provided if you
 just use this method e.g.
 `mysourceobject.relatedobjects.remove(targetobject)`.
 I don't see why
 
[https://github.com/django/django/blob/1.8.5/django/db/models/fields/related.py#L982
 it is disabled], and therefore would like to ask for a design change here,
 or an explanation.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.16b244f9c5b5054cfd099c1551326b79%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.