Re: possible bug in count() in many_to_many relations?

2010-01-24 Thread x13
On Jan 24, 9:16 pm, Russell Keith-Magee wrote: Thanks for your answers guys, > I'm assuming that you feel the right answer here is to return 0? yes, IMHO the count() function have to return an integer value without any exceptions. > > While I can certainly understand that sentiment, I'm not

Re: possible bug in count() in many_to_many relations?

2010-01-24 Thread Russell Keith-Magee
On Mon, Jan 25, 2010 at 7:14 AM, x13 wrote: > (sorry for my English mistakes) > Hello all, I have a problem with the count() function when I try to > use it in an empty many_to_many relationship. I have these models: > > > class Photo(models.Model): >   ... > > class Gallery(models.Model): >   ...

Re: possible bug in count() in many_to_many relations?

2010-01-24 Thread Peter Sagerson
I don't think this is a bug; it's just telling you that you can't count the photos until the gallery is in the database. Try: x = Gallery.objects.create() x.photo_count() On Jan 24, 2010, at 3:14 PM, x13 wrote: > (sorry for my English mistakes) > Hello all, I have a problem with the count() fu

possible bug in count() in many_to_many relations?

2010-01-24 Thread x13
(sorry for my English mistakes) Hello all, I have a problem with the count() function when I try to use it in an empty many_to_many relationship. I have these models: class Photo(models.Model): ... class Gallery(models.Model): ... photos = models.ManyToManyField('Photo', related_name='g