#item search - this will be expanded
item_query = get_query(query_string, ['title', 'author'])
#need to think about sort order here, probably better by author (will make sortable at display level)
- paginator = Paginator( models.Item.objects.filter(item_query).order_by('-date_created'),
+ results_list = models.Item.objects.filter(item_query).order_by('-date_created')
+ results_len = len(results_list)
+ paginator = Paginator( results_list,
count)
#course search
instructor_list = models.Member.objects.filter(instr_query).filter(role='INSTR').order_by('user__last_name')[0:5]
instr_len = len(models.Member.objects.filter(instr_query).filter(role='INSTR'))
else:
- paginator = Paginator( models.Item.objects.order_by('-date_created'),
+ results_list = models.Item.objects.order_by('-date_created')
+ results_len = len(results_list)
+ paginator = Paginator( results_list,
count)
course_list = models.Course.objects.filter(active=True).order_by('title')[0:5]
course_len = len(models.Course.objects.filter(active=True))
course_list=course_list,
instructor_list=instructor_list,
norm_query=norm_query,
+ results_len=results_len,
course_len=course_len,
instr_len=instr_len)
</script>
</head>
<body>
-<h1>${title}</h1>
+ <h1>${title}</h1>
-<h3 py:if="query_string">
- You searched: <i>${query_string}</i>
-</h3>
+ <h3 py:if="query_string">
+ You searched: <i>${query_string}</i>
+ </h3>
-<!-- not sure if this is the best way to do this -->
-<!--
- probably need a simple css option to hide instructors and course info
--->
-<table py:if="instructors or courses">
- <tr>
+ <!-- not sure if this is the best way to do this -->
+ <!--
+ probably need a simple css option to hide instructors and course info
+ -->
+ <table py:if="instructors or courses">
+ <tr>
<!-- instructors -->
- <td py:if="instructors" valign="top">
- <table>
+ <td py:if="instructors" valign="top" class="topbox">
+ <table class="topheading">
<tr>
<th>Last Name</th><th>First Name</th>
</tr>
</td>
<!-- courses -->
- <td py:if="courses" valign="top">
+ <td py:if="courses" valign="top" class="topbox">
<table>
<tr>
<th>Course</th>
</tr>
</table>
</td>
- </tr>
-</table>
+ </tr>
+ </table>
- <tr py:def="pageheader()">
+ <tr py:if="results_len > 0" py:def="pageheader()">
<th>Author</th><th>Title</th>
</tr>