On 1-2-2010 10:59, Kenneth Gonsalves wrote: > On Monday 01 Feb 2010 3:08:57 pm Daniel Roseman wrote: > >>> players = Matchentry.objects.filter(player__getcoursehandicap()__in= >>> [0..16]) >>> >>> of course this doesnt work - any clue how to do this? or do I fall back >>> on raw sql? >>> >> This is impossible to answer without knowing what getcoursehandicap >> does, and the structure of your models. Where is it getting the >> handicap for a player from? >> > it gets the handicapindex of the player form a model called Handicap which > has > foreign key to the player, and calculates the coursehandicap by getting some > values from two other models that are also related to Player by foreign keys. > Anyway, player.getcoursehandicap() works - but not within 'filter' > > >> In any case, you wouldn't use __in, but __range=(0, 16), for the >> >> > probably - but anyway I do not think django allows functions to be used on > the > left hand side of filters. > Isn't this possible by using player__handicap__handicapindex__range=[0..16] as filter?
Just thinking out loud. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.