On Wed, 2008-07-16 at 00:32 -0700, gnijholt wrote:
> Hello Django-users,
>
> Say I have a model that returns its name like this:
>
> def __unicode__(self):
> return str(self.distance_min) + "-" + str(self.distance_max)
>
> I want to filter this model based on those two values:
> Distance.objects.filter("241-250")
> this obviously does not work, but is it possible to do this?
Try
Distance.objects.filter(distance_min=241, distance_max=250)
This might be closer to what you are trying to do:
Distance.objects.filter(distance_min__gte=241, distance_max__lte=250)
If this does not work for you, try explaining the problem you are trying
to solve in greater detail.
Matthias
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---