Thanks Niphlod, :-)
This code works with webgrid component. But I get an error when I
try to use it with SQLForm.grid. Something like below -
-----------------------
Ticket ID
127.0.0.1.2013-04-08.22-09-49.ef6e6a56-089a-4c50-87fa-2099255002de
<type 'exceptions.AttributeError'> 'Rows' object has no attribute '_db'
Versionweb2py™Version 2.4.5-stable+timestamp.2013.03.18.22.46.22PythonPython
2.7.2: C:\Python27\python.exe (prefix: C:\Python27)Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
Traceback (most recent call last):
File "E:\Web2py\web2py\gluon\restricted.py", line 212, in restricted
exec ccode in environment
File "E:/Web2py/web2py/applications/BBOnline/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/BBOnline/controllers/default.py>,
line 3882, in <module>
File "E:\Web2py\web2py\gluon\globals.py", line 194, in <lambda>
self._caller = lambda f: f()
File "E:/Web2py/web2py/applications/BBOnline/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/BBOnline/controllers/default.py>,
line 729, in bug_new_tickets_created
create=False, deletable=False, details=True, editable=False, csv=False,
maxtextlength=64, paginate=15, ui='jquery-ui' )
File "E:\Web2py\web2py\gluon\sqlhtml.py", line 1808, in grid
db = query._db
AttributeError: 'Rows' object has no attribute '_db'
Error snapshot [image: help] Detailed traceback description
<http://127.0.0.1:8000/admin/default/ticket/BBOnline/127.0.0.1.2013-04-08.22-09-49.ef6e6a56-089a-4c50-87fa-2099255002de#>
<type 'exceptions.AttributeError'>('Rows' object has no attribute '_db')
----------------
However - for now I can use the above code with the workaround I have.
Thanks again. Web2py has all the good folks!!
Cheers, Rahul.
On Monday, April 8, 2013 6:57:18 PM UTC+5:30, Niphlod wrote:
>
> from datetime import timedelta
> now = request.now
> six_days_back = now - timedelta(days=6)
> db(
> (db.issues.date_today >= six_days_back) &
> (db.issues.date_today <= request.now)
> ).select(whateverfieldyouneed)
>
>
>
> On Monday, April 8, 2013 3:07:57 PM UTC+2, Rahul wrote:
>>
>> Hi All,
>> I am working on a query in SQLite - Where I can search on some data
>> for last 7 days -
>>
>> SQLite raw sql query is as follows:
>> query = db.executesql("SELECT ticket_no, description FROM issues where
>> date_today between datetime ('now', '-6 days') AND datetime ('now',
>> 'localtime')")
>>
>> I need to know the equivalent DAL version of it. Any help would be much
>> appreciated.
>>
>> Rahul
>>
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.