After reading
http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#first-and-last,
I was trying to use
def my_ctlr:
results = db().select(db.logtable.ALL, orderby=db.logtable.field1)
logs = results.last().as_dict()
return dict(logs = logs)
with a view using this
{{extend 'layout.html'}}
<h1>Hi</h1>
<ul>
{{for log in logs:}}
{{=LI(log)}}
{{pass}}
</ul>
and was expecting to get a row object (if I remove the .last(), I get a
bunch of row objects). Instead, I get several li items displayed that
apparently strings, and happen to match the field names. Since they are
strings, I can't apply .values() or .items().
If I replace the loop with
{{=BEAUTIFY(response._vars)}}
(as in generic.html)
I get the fieldnames and their values displayed in the programmer-friendly
format of the BEAUTIFY operator.
It is obvious that I don't know what I'm doing, especially in regards to
the last() operator. How can I get to having the values display as the LI
contents?
Version is 2.5.1-stable+timestamp.2013.06.06.15.39.19
(Running on Rocket 1.2.6)
Thanks.
/dps
--
---
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.