I don't know if this helps, or is exactly what your trying to avoid, but I've done something like this before (based on your example):
if use_sources: qSource = Q(source_time__range=(start_date, end_date)) else: qSource = Q(id__gt=0) if use_level: qLevel = Q(level__exact=level) else: qLevel = Q(id__gt=0) results = NodeEvent.objects.filter(qSource & qLevel) The idea is to build up a query with Q objects - and default to showing all (id__gt=0) It's still more complicated then going straight from the request variables to a query, but it works for me. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---