40 from soc.models.project_survey import ProjectSurvey |
40 from soc.models.project_survey import ProjectSurvey |
41 from soc.views.helper import access |
41 from soc.views.helper import access |
42 from soc.views.helper import decorators |
42 from soc.views.helper import decorators |
43 from soc.views.helper import redirects |
43 from soc.views.helper import redirects |
44 from soc.views.models import base |
44 from soc.views.models import base |
|
45 from soc.views.models import program as program_view |
45 |
46 |
46 |
47 |
47 class View(base.View): |
48 class View(base.View): |
48 """View methods for the GradingSurveyGroup model. |
49 """View methods for the GradingSurveyGroup model. |
49 """ |
50 """ |
55 Params: |
56 Params: |
56 params: a dict with params for this View |
57 params: a dict with params for this View |
57 """ |
58 """ |
58 |
59 |
59 rights = access.Checker(params) |
60 rights = access.Checker(params) |
60 rights['create'] = ['checkIsDeveloper'] |
61 rights['create'] = ['checkIsHostForProgramInScope'] |
61 rights['edit'] = ['checkIsDeveloper'] |
62 rights['edit'] = ['checkIsHostForProgramInScope'] |
62 rights['delete'] = ['checkIsDeveloper'] |
63 rights['delete'] = ['checkIsDeveloper'] |
63 rights['show'] = ['checkIsDeveloper'] |
64 rights['show'] = ['checkIsHostForProgramInScope'] |
64 rights['list'] = ['checkIsDeveloper'] |
65 rights['list'] = ['checkIsDeveloper'] |
65 |
66 |
66 new_params = {} |
67 new_params = {} |
67 new_params['logic'] = survey_group_logic |
68 new_params['logic'] = survey_group_logic |
68 new_params['rights'] = rights |
69 new_params['rights'] = rights |
69 new_params['name'] = "Grading Survey Group" |
70 new_params['name'] = "Grading Survey Group" |
70 new_params['sidebar_grouping'] = "Surveys" |
71 new_params['sidebar_grouping'] = "Surveys" |
71 |
72 |
|
73 new_params['scope_view'] = program_view |
|
74 new_params['scope_redirect'] = redirects.getCreateRedirect |
|
75 |
72 new_params['no_admin'] = True |
76 new_params['no_admin'] = True |
73 new_params['no_create_raw'] = True |
|
74 new_params['no_create_with_key_fields'] = True |
77 new_params['no_create_with_key_fields'] = True |
75 |
78 |
76 new_params['create_extra_dynaproperties'] = { |
79 new_params['create_extra_dynaproperties'] = { |
77 'grading_survey': djangoforms.ModelChoiceField( |
80 'grading_survey': djangoforms.ModelChoiceField( |
78 GradingProjectSurvey, required=True), |
81 GradingProjectSurvey, required=True), |
99 """Pass the correct survey queries to GroupForm. |
102 """Pass the correct survey queries to GroupForm. |
100 |
103 |
101 For params see base.View.create(). |
104 For params see base.View.create(). |
102 """ |
105 """ |
103 |
106 |
104 self.setQueries(kwargs['scope_path'], params['create_form']) |
107 if kwargs.get('scope_path'): |
|
108 self.setQueries(kwargs['scope_path'], params['create_form']) |
105 |
109 |
106 return super(View, self).create(request, access_type, page_name=page_name, |
110 return super(View, self).create(request, access_type, page_name=page_name, |
107 params=params, **kwargs) |
111 params=params, **kwargs) |
108 |
112 |
109 @decorators.merge_params |
113 @decorators.merge_params |