#9475: add(), create(), etc. should be supported by intermedite ManyToMany model
with extra attributes if extra fields can be calculated
---------------------------------------------------+------------------------
          Reporter:  o...@gezgin.com               |         Owner:  nobody
            Status:  new                           |     Milestone:        
         Component:  Database layer (models, ORM)  |       Version:  1.0   
        Resolution:                                |      Keywords:        
             Stage:  Accepted                      |     Has_patch:  0     
        Needs_docs:  0                             |   Needs_tests:  0     
Needs_better_patch:  1                             |  
---------------------------------------------------+------------------------
Comment (by anonymous):

 Replying to [comment:3 russellm]:
 > Thanks for the patch, However, this isn't something that should require
 a manual 'can_add' flag. We know all the relevant details - which fields
 are unique, which fields have defaults etc. We can therefore compute the
 value that can_add and can_remove provide manually in this patch.
 >
 > As a secondary issue, there is also an API issue around the call to
 add(). If you read the discussion on #6095 - the ticket that originally
 introduced m2m intermediates - there was some discussion about whether
 add() could be modified to allow people to add m2m entries *with*
 intermediate data. If we're going to close this ticket, it would be nice
 to get some resolution on this closely related issue, even if it's just to
 say "no".

 Exposing those flags (a two line change) allows fields on intermediary
 models to be filled in by `save()` and "bulk delete" behavior if the
 foreign keys are not `unique_together`. The ability to explicitly disable
 `add()` or `remove()` would be nice, but you could just say "don't do that
 then".

 Regarding your secondary issue, I'm in favour of allowing `add()` to just
 work for every m2m (Favoured color:
 {{{
 add(obj1, obj2, extra_field1="foo", extra_field2="bar")`
 }}}
 ). But that does not translate cleanly to `create()` and assignment. So
 the distinction between simple intermediary models and more complex ones
 probably won't go away.

 If some kind of `add(..., extra=...)` support is in scope for this ticket,
 I'll happily add it.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9475#comment:4>
Django <http://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 post to this group, send email to django-upda...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=.


Reply via email to