Permalink
Browse files

Make the section-list.html template nicer

  • Loading branch information...
1 parent 84d781f commit a83025020e499f8fa5f3f178aa05b91bd448c883 @chilts chilts committed Feb 3, 2010
Showing with 11 additions and 12 deletions.
  1. +10 −3 section.py
  2. +1 −9 theme/admin/section-list.html
View
@@ -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' );
@@ -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 @@ <h2>Section List</h2>
</tbody>
</table>
-{% else %}
-
-<p>There are no sections.</p>
-
-{% endif %}
-
{% endblock %}

0 comments on commit a830250

Please sign in to comment.