On Thu, Jul 2, 2009 at 10:43 PM, Xuqing Kuang <xuqingku...@gmail.com> wrote:

>
> Hi, all.
>
> I want to generate a report of my job status in somedays, so I make a
> QuerySet like following:
>
> ====================================
> # Generate query set
> jobs = Job.list(request.REQUEST)
>
> #today_jobs = jobs.filter(started_time__gte = date.fromtimestamp
> (time.time()))
> 7days_jobs = jobs.filter(started_time__gte = date.fromtimestamp
> (time.time() - 24 * 60 * 60 * 7))
> #30days_jobs = jobs.filter(started_time__gte = date.fromtimestamp
> (time.time() - 24 * 60 * 60 * 30))
> ====================================
>
> The issue is when I place the jobs QuerySet to the new value named
> 7days_jobs, Django will report
>
> ('invalid syntax', ('/Users/xkuang/Documents/Projects/DjangoApp/report/
> views.py', 157, 18, '        7days_jobs = jobs.filter
> (started_time__gte = date.fromtimestamp(time.time() - 24 * 60 * 60 *
> 7))\n'))
>
> But after I rename the 7days_jobs to jobs it will works fine, But the
> function I need will can not implemented.
>
> Does anybody know are there some solution to resolve it ?
>
> BTW: The another very strange thing is to place the QuerySet like
> following will works fine.
>
> ====================================
> # Get the lastest jobs of need
> top_longest_jobs = jobs.order_by('-process_time')[:10]
> top_recipes_jobs = jobs.order_by('-recipes_count')[:10]
> ====================================
>
> I'm very confusing in it ... Please help.
> >
>
In Python a variable cannot start with a number.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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

Reply via email to