This is my function
@auth.requires_membership('Capturista')
def lee_notas():
if len(request.args): page=int(request.args[0])
else: page=0
items_per_page=25
limitby=(page*items_per_page,(page+1)*items_per_page+1)
Capturista = db(db.capturistas.creadoPor==auth.user.id).select()
notas=db((db.notas.entregado==False)&
(db.notas.vendedor==db.vendedores.id)&
(db.vendedores.regional==Capturista[0].regional)).select
(db.notas.id,db.notas.nota, \
db.notas.folio,db.notas.armazon1,db.notas.lente1,db.notas.lc4,db.notas.total,db.notas.anticipo,db.notas.pago,db.notas.saldo,db.notas.vendedor,db.notas.optometrista,db.notas.creadoEl,orderby=~db.notas.nota,limitby=limitby)
return dict(notas=notas,page=page,items_per_page=items_per_page)
This is my view
{{extend 'layout.html'}}
<h4>Notas de Óptica Luz</h4>
[ {{=A('Crear 1(una) Nota de Venta', _href=URL(r=request,
f='crea_nota'))}} ]
<ul>{{for i,nota in enumerate(notas):}}
{{if i==items_per_page: break}}
{{=LI(A('Nota ',nota.nota,' Folio ',nota.folio,' [',db.armazones
[nota.armazon1].marca,' ',db.armazones[nota.armazon1].caract1,' &
',db.lentes[nota.lente1].material,' ',db.lentes[nota.lente1].tipo,'
',db.lentes[nota.lente1].tecnoVisual,' ',db.lentes
[nota.lente1].tratamiento,'] <',db.lentesContacto[nota.lc4].marca,'> T
$',nota.total,' - A$',nota.anticipo,' - P$',nota.pago,' = S
$',nota.saldo,' {',db.vendedores[nota.vendedor].names,' &
',db.optometristas[nota.optometrista].names,'}',' del ',nota.creadoEl,
_href=URL(r=request, f='show_nota', args=nota.id)))}}
{{pass}}</ul>
{{if page:}}
<a href="{{=URL(r=request,args=[page-1])}}">Anterior</a>
{{pass}}
{{if len(notas)>items_per_page:}}
<a href="{{=URL(r=request,args=[page+1])}}">Siguiente</a>
{{pass}}
When items_per_page=25 everything is ok
When I put items_per_page=50 Web2py give me this error:
Traceback (most recent call last):
File "/media/RESPALDO/web2py/gluon/restricted.py", line 184, in
restricted
exec ccode in environment
File "/media/RESPALDO/web2py/applications/seccion36/views/default/
lee_notas.html", line 38, in <module>
File "/media/RESPALDO/web2py/gluon/globals.py", line 112, in write
self.body.write(xmlescape(data))
File "/media/RESPALDO/web2py/gluon/html.py", line 103, in xmlescape
return data.xml()
File "/media/RESPALDO/web2py/gluon/html.py", line 517, in xml
(fa, co) = self._xml()
File "/media/RESPALDO/web2py/gluon/html.py", line 508, in _xml
self.components])
File "/media/RESPALDO/web2py/gluon/html.py", line 103, in xmlescape
return data.xml()
File "/media/RESPALDO/web2py/gluon/html.py", line 517, in xml
(fa, co) = self._xml()
File "/media/RESPALDO/web2py/gluon/html.py", line 508, in _xml
self.components])
File "/media/RESPALDO/web2py/gluon/html.py", line 103, in xmlescape
return data.xml()
File "/media/RESPALDO/web2py/gluon/sql.py", line 1370, in
__getattr__
self.__allocate()
File "/media/RESPALDO/web2py/gluon/sql.py", line 1365, in __allocate
raise Exception, "undefined record"
Exception: undefined record
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.