On Fri, Feb 11, 2011 at 9:19 PM, Shawn Milochik wrote:
> On Fri, Feb 11, 2011 at 4:15 PM, Tom Evans wrote:
>>
>> Have a read of this:
>>
>> http://www.secnetix.de/olli/Python/lambda_functions.hawk
>>
>
> That's funny -- I did a quick Google search and that's one I found
> also. I chose to give a
On Fri, Feb 11, 2011 at 4:15 PM, Tom Evans wrote:
>
> Have a read of this:
>
> http://www.secnetix.de/olli/Python/lambda_functions.hawk
>
That's funny -- I did a quick Google search and that's one I found
also. I chose to give a quick sample instead of sending the link
because I thought an exampl
On Fri, Feb 11, 2011 at 9:06 PM, kyleduncan wrote:
> I dont understand what the x is, but thank you so much for fixing this
> for me in a matter of minutes!
Have a read of this:
http://www.secnetix.de/olli/Python/lambda_functions.hawk
Cheers
Tom
--
You received this message because you are s
On Fri, Feb 11, 2011 at 4:06 PM, kyleduncan wrote:
> I dont understand what the x is, but thank you so much for fixing this
> for me in a matter of minutes!
>
You're welcome.
The 'key' kwarg to the sort function expects a value. Instead of
giving it a single value, you can pass a function.
So,
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 = lambda x: x.last_login
-
On Fri, Feb 11, 2011 at 3:59 PM, kyleduncan wrote:
> 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_lo
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 wrote:
> Something like
Something like this:
key = lambda x: x.last_login
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@google
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:
results.ap
On Mon, Feb 16, 2009 at 1:52 PM, jeffhg58 wrote:
>
> I have seen other posts on this topic but it seems that it was on the
> old trunk. I am using
> Django version 1.1 and I am unable to sort by foreign key
>
> When I try and execute the following query
>
> Result.objects.select_related().order_b
I have seen other posts on this topic but it seems that it was on the
old trunk. I am using
Django version 1.1 and I am unable to sort by foreign key
When I try and execute the following query
Result.objects.select_related().order_by('StatusId.Status')
I get 0 rows retrieved.
Is that the corr
On Fri, May 30, 2008 at 6:09 PM, robstar <[EMAIL PROTECTED]> wrote:
>
> Thanks for your help Richard.. taking out the select_related()
> results in the same problem. Isn't a OnetoOneField just a fancy name
> wrapper for a foreign key??
>
> mysql> describe itemengine_gear;
> +-+-
Thanks for your help Richard.. taking out the select_related()
results in the same problem. Isn't a OnetoOneField just a fancy name
wrapper for a foreign key??
mysql> describe itemengine_gear;
+-+--+--+-+-+---+
| Field | Type |
Wah, nevermind ..
Am 30.05.2008 um 01:27 schrieb Johannes Dollinger:
>
>> Should this work??
>>
>> results = Gear.objects.select_related().order_by
>> (generic_info__hits)
>
> Quotes are missing:
>
> Gear.objects.select_related().order_by('generic_info__hits')
>
>
>
>
>
> >
--~--~-
> Should this work??
>
> results = Gear.objects.select_related().order_by(generic_info__hits)
Quotes are missing:
Gear.objects.select_related().order_by('generic_info__hits')
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
I am not sure what is going on, however I wonder if it has something to do
with the OneToOne relationship, I do not use onetoone myself but notice in
the following from the db-api documentation:
Note that the select_related() QuerySet method recursively prepopulates the
cache of all one-to-many re
Oops, I had the ' ' in there somewhere in all my different iterations
of trying to make this work .. so the query works, but I can't access
the object in the template, or from the shell for that matter. Does
something change by doing this type of query?
On the shell:
>>> gear = Gear.objects.se
Oops, I had the ' ' in there somewhere in all my different iterations
of trying to make this work .. so the query works, but I can't access
the object in the template, or from the shell for that matter. Does
something change by doing this type of query?
On the shell:
>>> gear = Gear.objects.se
http://www.djangoproject.com/documentation/db-api/
contains the info you want. Try this:
Gear.objects.select_related().order_by('generic_info__hits')
you could also set the order_by in the Meta of Item to hits and then you
could just do:
Gear.objects.select_related().order_by('generic_info')
ht
Hey guys,
I read through some of the threads here, but still can't get this
simple scenario to work..
DB name: gcdb
class Item(models.Model):
hits= models.IntegerField(default=0)
class Gear(models.Model):
generic_info= models.OneToOneField(Item)
Should this work??
res
20 matches
Mail list logo