Commits

Luke Plant  committed 5f0969c Merge

Merged from default

  • Participants
  • Parent commits 1fd2dcb, ebfb8b5
  • Branches live

Comments (0)

Files changed (3)

File cciw/officers/admin.py

     list_display = ('referee_name', 'applicant_name', 'date_created')
     ordering = ('referee_name', )
     search_fields = ('referee_name','reference_info__application__officer__last_name', 'reference_info__application__officer__first_name')
+    date_hierarchy = 'date_created'
 
     fieldsets = (
         (None,

File cciw/officers/views.py

 def stats(request, year=None):
     year = int(year)
     stats = []
-    for camp in Camp.objects.filter(year=year).order_by('number'):
+    camps = list(Camp.objects.filter(year=year).order_by('number'))
+    if len(camps) == 0:
+        raise Http404
+    for camp in camps:
         stat = {}
         # For efficiency, we are careful about what DB queries we do and what is
         # done in Python.
     year = int(year)
     # We need a lot of information. Try to get it in a few up-front queries
     camps = list(Camp.objects.filter(year=year).order_by('number'))
+    if len(camps) == 0:
+        raise Http404
     # Selected camps:
     # We need to support URLs that indicate which camp to select, so we
     # can permalink nicely.

File templates/cciw/officers/stats.html

 <ul>
   <li>Ideally all lines should reach the 'Officer list' line by the start
     of camp.</li>
-  <li>The figure for references received has been divided by 2 to make the plot
-    fit the same target, since each officer needs 2 references. Correct figures
-    are shown when hovering.</li>
+  <li>Each officer needs 2 references, so the references plot has been divided
+    by 2 to make it fit the others. Correct figures are shown when hovering.</li>
   <li>Changes to the officer list are not tracked over time — only the current
     total is used.</li>
 </ul>