Hello I am trying to make a page showing a nested list:
period 1
subperiod 1
subperiod 2
subperiod 3
period 2
subperiod 1
subperiod 2
period 3
subperiod 1
period 4
subperiod 1
subperiod 2
subperiod 3
My model is:
db.define_table('period',
SQLField('description', length=150),
SQLField('date_start', 'date'), # date period starting
inclusive
SQLField('date_end', 'date'), #date period end
exclusive, is also starting date for next period
SQLField('open', 'boolean'),
SQLField('writable', 'boolean')
)
db.define_table('subperiod',
SQLField('period', db.period),
SQLField('description', length=150),
SQLField('date_start', 'date'), # date period starting
inclusive
SQLField('date_end', 'date'), #date period end
exclusive, is also starting date for next period
SQLField('open', 'boolean'),
SQLField('writable', 'boolean')
)
However I don't know how to do a controler and view to show a nested
list as above:
My controller is :
def show_periods():
#periods=db(db.period).select()
periods=SQLTABLE(db().select(db.period.ALL))
#subperiods=db(db.subperiod).select()
return dict(periods=periods) ##, subperiods=subperiods)
My view is
{{extend 'layout.html'}}
<h1>This is the test/show_periods.html template</h1>
<h2>{{=periods}}<h2>
Could anyone please help a newbie on this one?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---