Friday, August 27, 2010

filter by extra() fields

Hi,

does anyone know a way of filtering a QuerySet by a field that was
added through the extra() method?

For example, this is what I would like to do

_list_items = ListItem.objects.filter(list=1).extra(select='SELECT
value AS "type" FROM list_item_optional WHERE
list_item_optional.list_optional_id=1 AND
list_item_optional.list_item_id = list_item.id')
_list_items = _list_items.filter(type='A')

I know the above situation is not allowed, but what would be the
workaround in Django?

Cheers

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate