File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,10 +78,17 @@ def show_view(request, assignment_id):
7878 teacher_last_login = request .user .last_login
7979 time_24_hours_ago = now () - datetime .timedelta (days = 1 )
8080
81+ query = request .GET .get ("query" , "" )
82+
8183 period = request .GET .get ("period" , "" )
8284 period_set = course .period_set .order_by ("teacher" , "name" )
8385
84- if course .period_set .exists ():
86+ if query :
87+ active_period = "query"
88+ student_list = course .students .filter (full_name__icontains = query ).order_by (
89+ "periods" , "last_name"
90+ )
91+ elif course .period_set .exists ():
8592 if period == "" :
8693 if request .user in course .teacher .all ():
8794 try :
@@ -157,6 +164,7 @@ def show_view(request, assignment_id):
157164 ),
158165 "is_student" : course .is_student_in_course (request .user ),
159166 "is_teacher" : request .user in course .teacher .all (),
167+ "query" : query ,
160168 "period_set" : period_set ,
161169 "active_period" : active_period ,
162170 "quiz_accessible" : quiz_accessible ,
Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ a:hover {
216216 text-align : center;
217217}
218218
219- a .tin-btn {
219+ .tin-btn {
220220 border : 1px solid # cfcfcf ;
221221
222222 border-radius : 4px ;
Original file line number Diff line number Diff line change @@ -96,6 +96,16 @@ <h2 style="border-top:1px solid lightgray;padding-top:15px;">Filter Submissions<
9696 href ="{% url 'assignments:show' assignment.id %}?period=none "> None</ a >
9797 < a class ="right tin-btn " {% if active_period == "all " %}style ="color:#4fab4f !important "{% endif %}
9898 href ="{% url 'assignments:show' assignment.id %}?period=all "> All</ a >
99+  
100+ < form method ="GET " action ="{% url 'assignments:show' assignment.id %} " style ="display: inline-block; ">
101+ < label >
102+ < b > Matches:</ b >
103+ < input type ="text " name ="query " value ="{{ query }} " placeholder ="part of a name ">
104+ </ label >
105+ < button type ="submit " class ="tin-btn " style ="cursor: pointer;{% if active_period == "query " %}color:#4fab4f !important;{% endif %}">
106+ < i class ="fa fa-search "> </ i >
107+ </ button >
108+ </ form >
99109 < br > < br >
100110 {% for period in period_set %}
101111 < a class ="right tin-btn " {% if active_period.id == period.id %}style ="color:#4fab4f !important "{% endif %}
You can’t perform that action at this time.
0 commit comments