74 |
74 |
75 class View(role.RoleView): |
75 class View(role.RoleView): |
76 """View methods for the Host model. |
76 """View methods for the Host model. |
77 """ |
77 """ |
78 |
78 |
79 def __init__(self, original_params=None): |
79 def __init__(self, params=None): |
80 """Defines the fields and methods required for the base View class |
80 """Defines the fields and methods required for the base View class |
81 to provide the user with list, public, create, edit and delete views. |
81 to provide the user with list, public, create, edit and delete views. |
82 |
82 |
83 Params: |
83 Params: |
84 original_params: a dict with params for this View |
84 params: a dict with params for this View |
85 """ |
85 """ |
86 |
86 |
87 rights = {} |
87 rights = {} |
88 rights['edit'] = [access.checkIsInvited] |
88 rights['edit'] = [access.checkIsInvited] |
89 |
89 |
90 params = {} |
90 new_params = {} |
91 params['rights'] = rights |
91 new_params['rights'] = rights |
92 params['logic'] = soc.logic.models.host.logic |
92 new_params['logic'] = soc.logic.models.host.logic |
93 |
93 |
94 params['logic'] = soc.logic.models.host.logic |
94 new_params['logic'] = soc.logic.models.host.logic |
95 params['group_view'] = soc.views.models.sponsor.view |
95 new_params['group_view'] = soc.views.models.sponsor.view |
96 params['invite_filter'] = {'group_ln': 'link_id'} |
96 new_params['invite_filter'] = {'group_ln': 'link_id'} |
97 |
97 |
98 params['name'] = "Host" |
98 new_params['name'] = "Host" |
99 params['name_short'] = "Host" |
99 new_params['name_short'] = "Host" |
100 params['name_plural'] = "Hosts" |
100 new_params['name_plural'] = "Hosts" |
101 params['url_name'] = "host" |
101 new_params['url_name'] = "host" |
102 params['module_name'] = "host" |
102 new_params['module_name'] = "host" |
103 |
103 |
104 params['edit_form'] = EditForm |
104 new_params['edit_form'] = EditForm |
105 params['create_form'] = CreateForm |
105 new_params['create_form'] = CreateForm |
106 |
106 |
107 params = dicts.merge(original_params, params) |
107 params = dicts.merge(params, new_params) |
108 |
108 |
109 role.RoleView.__init__(self, params=params) |
109 role.RoleView.__init__(self, params=params) |
110 |
110 |
111 def _editPost(self, request, entity, fields): |
111 def _editPost(self, request, entity, fields): |
112 """See base.View._editPost(). |
112 """See base.View._editPost(). |