def bug_new_tickets_created():    
    db.issues.id.readable=False
    query = db((db.issues.date_today>=('now', '-6 days')) & 
(db.issues.workspace==user_workspace)).select()
    fields = (db.issues.ticket_no, db.issues.description,)
    headers = {'issues.ticket_no': 'Ticket #' , 'issues.description': 
'Description', }
    links = [ lambda row: A(SPAN(_class='icon 
magnifier'),'View',_class='button', _title='View 
Issue',_href=URL("default","view_issue",args=[row.id])),            
             ]
    grid_new_issues = SQLFORM.grid( query=query, fields=fields, 
headers=headers, links=links, user_signature=False, #details = 
auth.has_permission('read', db.projects_posts),
                         create=False, deletable=False, details=False, 
editable=False,  csv=False, maxtextlength=64, paginate=15, ui='jquery-ui' )
   
    return dict( grid_new_issues = grid_new_issues, counter = 
session.counter) 



On Tuesday, April 9, 2013 12:50:50 AM UTC+5:30, Massimo Di Pierro wrote:
>
> what's the code? You are passing rows/records where you are supposed to 
> pass a query.
>
> On Monday, 8 April 2013 13:46:03 UTC-5, Rahul wrote:
>>
>>
>> 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.


Reply via email to