Re: ManyToMany field q-s

2006-03-04 Thread Russell Keith-Magee
On 3/5/06, kmh <[EMAIL PROTECTED]> wrote: > > Russell Keith-Magee wrote: > > We could get really carried away here, but I'm not sure if there is > > any gain. The problem you are describing has existed since pre-MR days > > (and can be seen living large in the unit tests), and while it is an > > i

Re: ManyToMany field q-s

2006-03-04 Thread kmh
Russell Keith-Magee wrote: > On 3/3/06, kmh <[EMAIL PROTECTED] > wrote: > > > > My concern is that you end up with this: > > > > book.authors = [author1, author2] > > book.authors == [author1, author2] # not true > > Well, if we want to get picky like that, then book.authors should > evaluate as

Re: ManyToMany field q-s

2006-03-03 Thread Russell Keith-Magee
On 3/3/06, kmh <[EMAIL PROTECTED] > wrote: > > My concern is that you end up with this: > > book.authors = [author1, author2] > book.authors == [author1, author2] # not true Well, if we want to get picky like that, then book.authors should evaluate as a set as well, unless an order_by has been

Re: ManyToMany field q-s

2006-03-02 Thread kmh
Russell Keith-Magee wrote: > On 3/3/06, kmh <[EMAIL PROTECTED]> wrote: > > > > > > If it were a 'set' method assignment would not be possible and an > > exception hinting to use 'set' would be raised. > > > (Damn English language... setting the set with a set...) > > If I am understanding you corr

Re: ManyToMany field q-s

2006-03-02 Thread Russell Keith-Magee
On 3/3/06, kmh <[EMAIL PROTECTED]> wrote: If it were a 'set' method assignment would not be possible and anexception hinting to use 'set' would be raised.  (Damn English language... setting the set with a set...)If I am understanding you correctly, you are opposed to having assignment notation for

Re: ManyToMany field q-s

2006-03-02 Thread kmh
Russell Keith-Magee wrote: > On 3/3/06, kmh <[EMAIL PROTECTED]> wrote: > > > Assigning a list implies assigning an order. How about: > > > book.authors.set([author1, author2]) > > > This doesn't address the problem - what is the 'set' behaviour of the > descriptor protocol. >The start of the expre

Re: ManyToMany field q-s

2006-03-02 Thread Russell Keith-Magee
On 3/3/06, kmh <[EMAIL PROTECTED]> wrote: Assigning a list implies assigning an order. How about:book.authors.set([author1, author2]) This doesn't address the problem - what is the 'set' behaviour of the descriptor protocol. The start of the _expression_ has to be 'book.authors ='; the question is

Re: ManyToMany field q-s

2006-03-02 Thread kmh
Russell Keith-Magee wrote: > I can see the merit in finishing the descriptor protocol > for all m2m objects. So: > > book.authors = [author1, author2] > would be equivalent to > book.author.clear(); book.author.add(author1, author2) Assigning a list implies assigning an order. How about: book.au

Re: ManyToMany field q-s

2006-03-02 Thread Russell Keith-Magee
On 3/3/06, Luke Plant <[EMAIL PROTECTED]> wrote: fields.  For ManyToMany, you do:  book.author.add(author1, author2...)I guess it would be good if the __set__ descriptor was there, and eitherdid the right thing or threw some exception. I've been working with the descriptor protocol on RelatedManage

Re: ManyToMany field q-s

2006-03-02 Thread Luke Plant
On Thursday 02 March 2006 04:49, xamdam wrote: > class Book(models.Model): > name = models.CharField(maxlength=200) > author = models.ManyToManyField(Person) > def set_author(self, a): self.author = a # is this (having to > define the set_ method) fixed yet? > def __repr__(self):

ManyToMany field q-s

2006-03-01 Thread xamdam
I am playing with a class like this: class Book(models.Model): name = models.CharField(maxlength=200) author = models.ManyToManyField(Person) def set_author(self, a): self.author = a # is this (having to define the set_ method) fixed yet? def __repr__(self): return self.na