I hang my head in shame. I had the name and type reversed in my Ajax
call to the view.

:(

On May 31, 12:19 pm, Stodge <sto...@gmail.com> wrote:
> Weird:
>
> syslog.syslog("Connections = %s" % str(connection.queries))
>
> gives:
>
> May 31 12:18:41 localhost python: Connections = []
>
> On May 31, 12:12 pm, Stodge <sto...@gmail.com> wrote:
>
>
>
> > Thanks. The various pieces of data (self.name etc) are 100% correct -
> > I dumped them all using syslog. However, it just occurred to me that
> > maybe it's a unicode/string issue. I'm trying to dump the SQL that's
> > generated - debug_toolbar isn't working for me.
>
> > The timestamps are generated from the request and they too are
> > correct, assuming here that year, month and day have the correct
> > values:
>
> >                 today = datetime.datetime(self.req_year, self.req_month,
> > self.req_day)
> >                 tomorrow = today + datetime.timedelta(days=1)
>
> > Thanks
>
> > On May 31, 12:08 pm, Javier Guerra Giraldez <jav...@guerrag.com>
> > wrote:
>
> > > 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.

Reply via email to