Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make the section-list.html template nicer

  • Loading branch information...
commit a83025020e499f8fa5f3f178aa05b91bd448c883 1 parent 84d781f
@chilts chilts authored
Showing with 11 additions and 12 deletions.
  1. +10 −3 section.py
  2. +1 −9 theme/admin/section-list.html
View
13 section.py
@@ -40,13 +40,20 @@
## ----------------------------------------------------------------------------
+section_count = 20
+
# List
class List(webbase.WebBase):
def get(self):
- sections = Section.all()
+ sections = Section.all().fetch(section_count+1)
+
+ more = True if len(sections) > section_count else False
+
vals = {
- 'title' : 'Section List',
- 'sections' : sections
+ 'title' : 'Section List',
+ 'sections' : sections,
+ 'section_count' : section_count if more else len(sections),
+ 'more' : more,
}
self.template( 'section-list.html', vals, 'admin' );
View
10 theme/admin/section-list.html
@@ -4,9 +4,7 @@
<h2>Section List</h2>
-{% if sections.count %}
-
-<p>There are {{ sections.count|escape }} sections.</p>
+<p>There {{ sections|length|pluralize:"is,are" }} {{ more|yesno:"more than," }} {{ section_count|escape }} section{{ sections|length|pluralize }}.</p>
<table class="list striped">
<thead>
@@ -43,10 +41,4 @@
</tbody>
</table>
-{% else %}
-
-<p>There are no sections.</p>
-
-{% endif %}
-
{% endblock %}
Please sign in to comment.
Something went wrong with that request. Please try again.