Re: Need to combine 2 QuerySets without losing ability to order_by foreign key afterwards

2011-02-11 Thread kyleduncan
this seems to work: results = sorted(results, key=lambda x: x.user.last_login, reverse=True) I dont understand what the x is, but thank you so much for fixing this for me in a matter of minutes! On Feb 11, 8:36 pm, Shawn Milochik wrote: > Something like this: > > key =

Re: Need to combine 2 QuerySets without losing ability to order_by foreign key afterwards

2011-02-11 Thread kyleduncan
Thank you! Not sure how to work it just yet though. do I replace x with user? i tried this: results = results.sort(key=lambda x: x.last_login, reverse=True) and got an error that the Profile object didn't have the attribute last_login On Feb 11, 8:36 pm, Shawn Milochik

Need to combine 2 QuerySets without losing ability to order_by foreign key afterwards

2011-02-11 Thread kyleduncan
Hi, I have the following code: results = list(results.filter(**location_distance_kwargs)) for trip in possible_trips: try: trip = Trip.objects.get(id=trip.id, **trip_kwargs) profile = Profile.objects.get(user=trip.user) if profile not in results:

Re: GeoDjango: default 4326 SRID doesn't work for transform()

2010-08-30 Thread kyleduncan
() (and also placing it after) and i'll also specify the transform SRID of 900973 (is that the SRID for google or are you talking about something else with that number?) thanks again Kyle On Aug 30, 9:16 am, Reinout van Rees <rein...@vanrees.org> wrote: > On 08/29/2010 07:45 PM, kyleduncan wr

Re: GeoDjango: default 4326 SRID doesn't work for transform()

2010-08-29 Thread kyleduncan
Sorry, i forgot to mention that this is the model field I am retrieving user's locations from: location = geomodels.PointField(null=True, blank=True) which comes back as: POINT(longitude, latitude) and we are using a PostGreSQL database. On Aug 29, 6:45 pm, kyleduncan <kyledun...@hotmail.

GeoDjango: default 4326 SRID doesn't work for transform()

2010-08-29 Thread kyleduncan
Hi all, I am trying to do obtain the distance between two users on my site, using code I found in this group. We already have geoDjango installed, though i'm wondering if my problem comes from being on an old version (i dont know which version we're using - if somebody could tell me how to check