Added messages to the Records page when a task has been successfully started.
authorLennard de Rijk <ljvderijk@gmail.com>
Mon, 13 Jul 2009 01:15:46 +0200
changeset 2623 9848682af610
parent 2622 f37d7d564f88
child 2624 5604204998c5
Added messages to the Records page when a task has been successfully started.
app/soc/templates/soc/grading_survey_group/records.html
app/soc/views/models/grading_survey_group.py
--- a/app/soc/templates/soc/grading_survey_group/records.html	Mon Jul 13 01:07:18 2009 +0200
+++ b/app/soc/templates/soc/grading_survey_group/records.html	Mon Jul 13 01:15:46 2009 +0200
@@ -20,7 +20,7 @@
   All records collected for this Grading Survey Group are shown on this page.
 </p>
 
-{{ message }}
+<div id="message">{{ message }}</div>
 
 <form method="post">
   <table>
--- a/app/soc/views/models/grading_survey_group.py	Mon Jul 13 01:07:18 2009 +0200
+++ b/app/soc/views/models/grading_survey_group.py	Mon Jul 13 01:15:46 2009 +0200
@@ -243,6 +243,13 @@
       return responses.errorResponse(
           error, request, template=params['error_public'])
 
+    # get the context for this webpage
+    context = responses.getUniversalContext(request)
+    responses.useJavaScript(context, params['js_uses_all'])
+    context['page_name'] = "%s for %s named '%s'" %(
+        page_name, params['name'], entity.name)
+    context['entity'] = entity
+
     # get the POST request dictionary and check if we should take action
     post_dict = request.POST
 
@@ -259,6 +266,8 @@
       fields = {'last_update_started': datetime.datetime.now()}
       survey_group_logic.updateEntityProperties(entity, fields)
 
+      context['message'] = 'Updating GradingRecords successfully started'
+
     if post_dict.get('update_projects'):
       # start the task to update all StudentProjects for the given group
       task_params = {
@@ -268,6 +277,7 @@
       new_task = taskqueue.Task(params=task_params, url=task_url)
       new_task.add()
 
+      context['message'] = 'Updating StudentProjects successfully started'
 
     template = params['records_template']
 
@@ -278,13 +288,6 @@
     # TODO(ljvderijk) proper redirect to edit a record
     list_params['list_action'] = None
 
-    # get the context for this webpage
-    context = responses.getUniversalContext(request)
-    responses.useJavaScript(context, params['js_uses_all'])
-    context['page_name'] = "%s for %s named '%s'" %(
-        page_name, params['name'], entity.name)
-    context['entity'] = entity
-
     fields = {'grading_survey_group': entity}
 
     # list all records with grading_decision set to pass