I dont know how this could be different but this one did worked:
desde=request.now
hasta=request.now
desde=datetime.datetime(request.now.year,request.now.month,request.now.day)
hasta=desde+datetime.timedelta(days=10)
form=FORM (H1(TABLE
(TR(('From:',INPUT(_name="desde",_class='date',_value=desde,_id="desde",requires=IS_DATE())),
('To:',INPUT(_name="hasta",_class='date',_id="hasta",_value=hasta,requires=IS_DATE()))),
INPUT(_type='submit'))))
rows = db((db.orden.fechaorden >=
request.vars.desde)&(db.orden.fechaorden <=
request.vars.hasta)).select(db.orden.waitertip.sum())
for row in rows: print
row[db.orden.waitertip.sum()]
return dict(form=form,rows=rows)
I do however get some receding zeros after the date in my date field
of the form.
On Jun 15, 11:51 pm, mdipierro <[email protected]> wrote:
> This should never have worked.
>
> On Jun 15, 8:57 pm, "mr.freeze" <[email protected]> wrote:
>
> > I would just check that fromvar and tovar are not None before getting
> > the rows.
>
> > On Jun 15, 8:40 pm, greenpoise <[email protected]> wrote:
>
> > > here it is:
>
> > > Error traceback
>
> > > 1.
> > > 2.
> > > 3.
> > > 4.
> > > 5.
> > > 6.
> > > 7.
> > > 8.
> > > 9.
> > > 10.
> > > 11.
> > > 12.
> > > 13.
> > > 14.
> > > 15.
> > > 16.
>
> > > Traceback (most recent call last):
> > > File "/home/danel/Applications/web2py/gluon/restricted.py", line
> > > 178, in restricted
> > > exec ccode in environment
> > > File "/home/danel/Applications/web2py/applications/shroomV2/
> > > controllers/default.py", line 314, in <module>
> > > File "/home/danel/Applications/web2py/gluon/globals.py", line 96, in
> > > <lambda>
> > > self._caller = lambda f: f()
> > > File "/home/danel/Applications/web2py/gluon/tools.py", line 2036, in
> > > f
> > > return action(*a, **b)
> > > File "/home/danel/Applications/web2py/applications/shroomV2/
> > > controllers/default.py", line 245, in qryfecha
> > > rows = db((db.orden.fechaorden >= fromvar)&(db.orden.fechaorden <=
> > > tovar)).select(db.orden.waitertip.sum())
> > > File "/home/danel/Applications/web2py/gluon/sql.py", line 2483, in
> > > __ge__
> > > return Query(self, '>=', value)
> > > File "/home/danel/Applications/web2py/gluon/sql.py", line 2866, in
> > > __init__
> > > raise SyntaxError, 'Operation %s can\'t be used with None' % op
> > > SyntaxError: Operation >= can't be used with None
>
> > > On Jun 15, 9:37 pm, "mr.freeze" <[email protected]> wrote:
>
> > > > Do you get an error? If so, can you show the traceback?
>
> > > > On Jun 15, 8:01 pm, greenpoise <[email protected]> wrote:
>
> > > > > Ok this used to work:
>
> > > > > def qryfecha():
>
> > > > > form=FORM (H1(TABLE
> > > > > (TR(('From:',INPUT(_name="desde",_class='date',_id="desde",requires=IS_DATE
> > > > > ())),
>
> > > > > ('To:',INPUT(_name="to",_class='date',_id="to",default=request.now,requires
> > > > > =IS_DATE())))),
> > > > > INPUT(_type='submit')))
>
> > > > > fromvar=request.vars.desde
> > > > > tovar=request.vars.to
>
> > > > > rows = db((db.orden.fechaorden >= fromvar)&(db.orden.fechaorden <=
> > > > > tovar)).select(db.orden.waitertip.sum())
> > > > > for row in rows: print
> > > > > row[db.orden.waitertip.sum()]
>
> > > > > return dict(form=form,rows=rows)
>
> > > > > not anymore. Leads?