On Mon, May 31, 2010 at 9:56 AM, Stodge <sto...@gmail.com> wrote: > I have a query that filters on four fields: > > res = MyModel.objects.filter(name=self.name, > type=self.type, > > last_update_time__gte=today, > > last_update_time__lte=tomorrow) > > If I enter the exact same query in the shell, I get the correct > results from the database. If I access my app through the browser and > let it run the query, I get zero results. The settings file is correct
all four of these parameters need some context (the 'self' object, and those 'today' and 'tomorrow' variables). obviously, you couldn't just type that in the shell and get any result. so, the problem might lay in some other code you're not showing. just guessing: something that has bitten me before is that even if querysets are lazy, the paraemters it gets aren't. specially when they're time dependent, like 'today' and 'tomorrow'. if you're creating this queryset at startup, these values might not be correct when you finally evaluate the query. -- Javier -- 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.