Re: Finding out the index of a model instance in a list

2008-03-29 Thread [EMAIL PROTECTED]
I'd consider grabbing a list of GalleryImage objects and then using the forloop.counter in the template as you iterate over each item. Right now, it looks like you're only grabbing one item with IImage, even though you're using filter(). I'd try it this way: ImageList =

Re: Finding out the index of a model instance in a list

2008-03-29 Thread Colin Bean
> > lImage = GalleryImage.objects.filter(pk=pImageSerial).select_related()[0] > lAlbumImages = GalleryImage.objects.filter(album__id = lImage.album.id) > lImagesInAlbum = lAlbumImages.count() > lImagePosition = None > lPreviousImage = None > lNextImage = None > for

Re: Finding out the index of a model instance in a list

2008-03-29 Thread Tim Sawyer
Is there a better way that this? lImage = GalleryImage.objects.filter(pk=pImageSerial).select_related()[0] lAlbumImages = GalleryImage.objects.filter(album__id = lImage.album.id) lImagesInAlbum = lAlbumImages.count() lImagePosition = None lPreviousImage = None lNextImage

Finding out the index of a model instance in a list

2008-03-29 Thread Tim Sawyer
Hi Folks, If I have an image, and a list of images, how can I work out what position in the list my image is so I can do a Image 4 of 24 type annotation? lImage = GalleryImage.objects.filter(pk=pImageSerial).select_related()[0] lAlbumImages = GalleryImage.objects.filter(album__id =