Re: how to display only one instance of an object returned by a query.

2010-04-26 Thread Dexter
Oops, wrong post On Mon, Apr 26, 2010 at 9:23 PM, Dexter wrote: > It doesn't seem to work very good. > > > On Mon, Apr 26, 2010 at 8:53 PM, greatlemer wrote: > >> > @G >> > >> > thanks for that. the code im writing will wait til dev version

Re: how to display only one instance of an object returned by a query.

2010-04-26 Thread Dexter
It doesn't seem to work very good. On Mon, Apr 26, 2010 at 8:53 PM, greatlemer wrote: > > @G > > > > thanks for that. the code im writing will wait til dev version becomes > > 1.2 so at least i know there is a way to do it in the next version. > > must check when 1.2

Re: how to display only one instance of an object returned by a query.

2010-04-26 Thread greatlemer
> @G > > thanks for that. the code im writing will wait til dev version becomes > 1.2 so at least i know there is a way to do it in the next version. > must check when 1.2 is gonna land. You probably noticed anyway but ifchanged is actually in the current version (and has been since at least 1.0)

Re: how to display only one instance of an object returned by a query.

2010-04-26 Thread shofty
On Apr 26, 2:51 pm, ondrey wrote: > for details > seehttp://docs.djangoproject.com/en/1.1/ref/models/querysets/#order-by-f... > i honestly read that aricle a couple of times and totally missed it. straight in there and working, thanks for pointing it out in plain

Re: how to display only one instance of an object returned by a query.

2010-04-26 Thread greatlemer
> finally when i write out the vehicles, i'd like to write a different > line for the first of each type of vehicle. to explain that, the > output should be an image linked to a fancybox gallery. because of the > amount of different vehicles, i'd like to only show one image of each > vehicle, but

Re: how to display only one instance of an object returned by a query.

2010-04-26 Thread ondrey
Hi, if your models look something like this: class Car(models.Model): name = models.CharField() class Photo(models.Model): car = models.ForeignKey(Car) added_date = models.DateField() then you can sort the photo queryset by the related model's (i.e. car's)

Re: how to display only one instance of an object returned by a query.

2010-04-26 Thread shofty
hmmm, wasn;t expecting that response. im guessing from it, that you're suggesting it should be possible. I don't have the exact error message to hand, but i will recreate it and post it, as i really just thought i was being silly by trying to link to data from a model linked by PK. give me a few

Re: how to display only one instance of an object returned by a query.

2010-04-26 Thread Shawn Milochik
> my queryset is bringing back all of the photos and the for loop writes > them all out. currently the photos come back in order of addition, > since all i've got to sort them on is added_date. (i tried ordering > the photos by the FK which is car.name but that didn't work). Why doesn't this

how to display only one instance of an object returned by a query.

2010-04-26 Thread shofty
im really struggling to work out how to phrase this question, which is why i've had zero luck googling it. i'll try and explain it. ive got two models. car and photo in a one to many relationship. my queryset is bringing back all of the photos and the for loop writes them all out. currently the