Advertisement
Guest User

Untitled

a guest
Dec 7th, 2018
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.32 KB | None | 0 0
  1. % # First declare that output from this template is to be put inside another template after running all the code (rendering)
  2. % rebase(skinning + '_skin.tpl', title=page_title)     # (See note above)
  3. % # From here, concentrate on the content we would like to show:
  4. <!-- Lines not starting with % are standard HTML. This HTML code is defined in views/all_items.tpl -->
  5. <div class="table-responsive">
  6.   <table class="table table-striped">
  7.     <thead>
  8.       <tr>
  9.         <th scope="col">No.</th>
  10.         % for k in displaykeys:
  11.         <th scope="col">{{k.title()}}</th>
  12.         % end   # Usual python indention to structure code does not work in .tpl files - "end" is used instead to end a block
  13.       </tr>
  14.     </thead>
  15.     <tbody>
  16.       % for i, d in enumerate(displaydata):    # displaydata is expected to be a list of dictionaries
  17.       % link_url = "/events/" + str(i + 1)     # relative url to detailed view
  18.       <tr>
  19.         <th scope="row">{{i + 1}}</th>
  20.         % for k in displaykeys:     # Go thru the keys in the same order as for the headline row
  21.         <td><a href="{{link_url}}" alt="See details">{{displaydata[i][k]}}</a></td>
  22.         % end   # Usual python indention to structure code does not work in .tpl files - "end" is used instead to end a block
  23.       </tr>
  24.       % end
  25.     </tbody>
  26.   </table>
  27. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement