80 |
80 |
81 class View(base.View): |
81 class View(base.View): |
82 """View methods for the Sponsor model. |
82 """View methods for the Sponsor model. |
83 """ |
83 """ |
84 |
84 |
85 def __init__(self, original_params=None, original_rights=None): |
85 def __init__(self, original_params=None): |
86 """Defines the fields and methods required for the base View class |
86 """Defines the fields and methods required for the base View class |
87 to provide the user with list, public, create, edit and delete views. |
87 to provide the user with list, public, create, edit and delete views. |
88 |
88 |
89 Params: |
89 Params: |
90 original_params: a dict with params for this View |
90 original_params: a dict with params for this View |
91 original_rights: a dict with right definitions for this View |
|
92 """ |
91 """ |
93 |
92 |
94 self._logic = soc.logic.models.sponsor.logic |
93 self._logic = soc.logic.models.sponsor.logic |
95 |
94 |
96 params = {} |
95 params = {} |
97 rights = {} |
|
98 |
96 |
99 params['name'] = "Sponsor" |
97 params['name'] = "Sponsor" |
100 params['name_short'] = "Sponsor" |
98 params['name_short'] = "Sponsor" |
101 params['name_plural'] = "Sponsors" |
99 params['name_plural'] = "Sponsors" |
102 # TODO(pawel.solyga): create url_name and module_name automatically |
100 # TODO(pawel.solyga): create url_name and module_name automatically |
126 |
124 |
127 params['edit_params'] = { |
125 params['edit_params'] = { |
128 self.DEF_SUBMIT_MSG_PARAM_NAME: self.DEF_SUBMIT_MSG_PROFILE_SAVED, |
126 self.DEF_SUBMIT_MSG_PARAM_NAME: self.DEF_SUBMIT_MSG_PROFILE_SAVED, |
129 } |
127 } |
130 |
128 |
131 rights['list'] = [helper.access.checkIsDeveloper] |
|
132 rights['delete'] = [helper.access.checkIsDeveloper] |
|
133 |
|
134 params = dicts.merge(original_params, params) |
129 params = dicts.merge(original_params, params) |
135 rights = dicts.merge(original_rights, rights) |
|
136 |
130 |
137 base.View.__init__(self, rights=rights, params=params) |
131 base.View.__init__(self, params=params) |
138 |
132 |
139 def _editPost(self, request, entity, fields): |
133 def _editPost(self, request, entity, fields): |
140 """See base.View._editPost(). |
134 """See base.View._editPost(). |
141 """ |
135 """ |
142 |
136 |