Enable the ProjectSurvey and GradingProjectSurvey views in the core.
Also add menu items to the program menu for easy access to these options.
Reviewed by: Lennard de Rijk
--- a/app/soc/models/grading_project_survey_record.py Thu Jul 02 17:51:07 2009 +0200
+++ b/app/soc/models/grading_project_survey_record.py Thu Jul 02 18:33:13 2009 +0200
@@ -40,4 +40,5 @@
"""
#: Required grade given to the project that this survey is about.
+ #: Symbolizes pass(=True) or fail(=False)
grade = db.BooleanProperty(required=True)
--- a/app/soc/modules/soc_core/callback.py Thu Jul 02 17:51:07 2009 +0200
+++ b/app/soc/modules/soc_core/callback.py Thu Jul 02 18:33:13 2009 +0200
@@ -27,6 +27,7 @@
from soc.views.models import club_member
from soc.views.models import cron
from soc.views.models import document
+from soc.views.models import grading_project_survey as grading_survey
from soc.views.models import host
from soc.views.models import job
from soc.views.models import mentor
@@ -36,6 +37,7 @@
from soc.views.models import org_app
from soc.views.models import priority_group
from soc.views.models import program
+from soc.views.models import project_survey
from soc.views.models import request
from soc.views.models import site
from soc.views.models import sponsor
@@ -77,6 +79,7 @@
self.core.registerSitemapEntry(cron.view.getDjangoURLPatterns())
self.core.registerSitemapEntry(document.view.getDjangoURLPatterns())
+ self.core.registerSitemapEntry(grading_survey.view.getDjangoURLPatterns())
self.core.registerSitemapEntry(host.view.getDjangoURLPatterns())
self.core.registerSitemapEntry(job.view.getDjangoURLPatterns())
self.core.registerSitemapEntry(mentor.view.getDjangoURLPatterns())
@@ -86,6 +89,7 @@
self.core.registerSitemapEntry(org_app.view.getDjangoURLPatterns())
self.core.registerSitemapEntry(priority_group.view.getDjangoURLPatterns())
self.core.registerSitemapEntry(program.view.getDjangoURLPatterns())
+ self.core.registerSitemapEntry(project_survey.view.getDjangoURLPatterns())
self.core.registerSitemapEntry(request.view.getDjangoURLPatterns())
self.core.registerSitemapEntry(site.view.getDjangoURLPatterns())
self.core.registerSitemapEntry(sponsor.view.getDjangoURLPatterns())
--- a/app/soc/views/helper/redirects.py Thu Jul 02 17:51:07 2009 +0200
+++ b/app/soc/views/helper/redirects.py Thu Jul 02 18:33:13 2009 +0200
@@ -347,25 +347,18 @@
return '/document/list/%s/%s' % (prefix, entity.key().id_or_name())
-def getCreateSurveyRedirect(entity, prefix):
- """Returns the redirect for new documents.
+def getCreateSurveyRedirect(entity, prefix, url_name):
+ """Returns the redirect for new surveys.
"""
- return '/survey/create/%s/%s' % (prefix, entity.key().id_or_name())
+ return '/%s/create/%s/%s' % (url_name, prefix, entity.key().id_or_name())
-def getListSurveysRedirect(entity, prefix):
- """Returns the redirect for listing documents.
+def getListSurveysRedirect(entity, prefix, url_name):
+ """Returns the redirect for listing surveys.
"""
- return '/survey/list/%s/%s' % (prefix, entity.key().id_or_name())
-
-
-def getListSurveyResultsRedirect(entity, prefix):
- """Returns the redirect for listing documents.
- """
-
- return '/survey/list_results/%s/%s' % (prefix, entity.key().id_or_name())
+ return '/%s/list/%s/%s' % (url_name, prefix, entity.key().id_or_name())
def getTakeProjectSurveyRedirect(entity, info):
--- a/app/soc/views/models/program.py Thu Jul 02 17:51:07 2009 +0200
+++ b/app/soc/views/models/program.py Thu Jul 02 18:33:13 2009 +0200
@@ -672,11 +672,29 @@
items += [(redirects.getListDocumentsRedirect(entity, 'program'),
"List Documents", 'any_access')]
# add link to create a new Program Survey
- items += [(redirects.getCreateSurveyRedirect(entity, 'program'),
+ items += [(redirects.getCreateSurveyRedirect(entity, 'program',
+ 'survey'),
"Create a New Survey", 'any_access')]
# add link to list all Program Surveys
- items += [(redirects.getListSurveysRedirect(entity, 'program'),
+ items += [(redirects.getListSurveysRedirect(entity, 'program',
+ 'survey'),
"List Surveys", 'any_access')]
+ # add link to create a new Project Survey
+ items += [(redirects.getCreateSurveyRedirect(entity, 'program',
+ 'project_survey'),
+ "Create a New Project Survey", 'any_access')]
+ # add link to list all Project Surveys
+ items += [(redirects.getListSurveysRedirect(entity, 'program',
+ 'project_survey'),
+ "List Project Surveys", 'any_access')]
+ # add link to create a new Grading Survey
+ items += [(redirects.getCreateSurveyRedirect(entity, 'program',
+ 'grade_survey'),
+ "Create a New Grading Survey", 'any_access')]
+ # add link to list all Grading Surveys
+ items += [(redirects.getListSurveysRedirect(entity, 'program',
+ 'grade_survey'),
+ "List Grading Surveys", 'any_access')]
except out_of_band.Error:
pass