Xuqing Kuang
unread,Jul 2, 2009, 11:43:21 PM7/2/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
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.