60 |
60 |
61 class View(presence.View): |
61 class View(presence.View): |
62 """View methods for the Document model. |
62 """View methods for the Document model. |
63 """ |
63 """ |
64 |
64 |
65 def __init__(self, original_params=None): |
65 def __init__(self, params=None): |
66 """Defines the fields and methods required for the base View class |
66 """Defines the fields and methods required for the base View class |
67 to provide the user with list, public, create, edit and delete views. |
67 to provide the user with list, public, create, edit and delete views. |
68 |
68 |
69 Params: |
69 Params: |
70 original_params: a dict with params for this View |
70 params: a dict with params for this View |
71 """ |
71 """ |
72 |
72 |
73 params = {} |
73 new_params = {} |
74 params['logic'] = soc.logic.models.site.logic |
74 new_params['logic'] = soc.logic.models.site.logic |
75 |
75 |
76 # TODO(alturin): add ugettext_lazy ? |
76 # TODO(alturin): add ugettext_lazy ? |
77 params['name'] = "Site Settings" |
77 new_params['name'] = "Site Settings" |
78 params['name_short'] = "Site" |
78 new_params['name_short'] = "Site" |
79 params['name_plural'] = "Site Settings" |
79 new_params['name_plural'] = "Site Settings" |
80 # lower name and replace " " with "/" |
80 # lower name and replace " " with "/" |
81 params['url_name'] = "site/settings" |
81 new_params['url_name'] = "site/settings" |
82 params['module_name'] = "site" |
82 new_params['module_name'] = "site" |
83 |
83 |
84 params['edit_form'] = EditForm |
84 new_params['edit_form'] = EditForm |
85 params['create_form'] = CreateForm |
85 new_params['create_form'] = CreateForm |
86 |
86 |
87 params['sidebar_defaults'] = [('/%s/edit', 'Edit %(name)s', 'edit')] |
87 new_params['sidebar_defaults'] = [('/%s/edit', 'Edit %(name)s', 'edit')] |
88 params['sidebar_heading'] = params['name_short'] |
88 new_params['sidebar_heading'] = new_params['name_short'] |
89 |
89 |
90 params['public_template'] = 'soc/home/public.html' |
90 new_params['public_template'] = 'soc/home/public.html' |
91 |
91 |
92 params['rights'] = { |
92 new_params['rights'] = { |
93 'unspecified': [access.checkIsDeveloper], |
93 'unspecified': [access.checkIsDeveloper], |
94 'any_access': [access.allow], |
94 'any_access': [access.allow], |
95 'public': [access.allow] |
95 'public': [access.allow] |
96 } |
96 } |
97 |
97 |
98 params = dicts.merge(original_params, params) |
98 params = dicts.merge(params, new_params) |
99 |
99 |
100 presence.View.__init__(self, original_params=params) |
100 super(View, self).__init__(params=params) |
101 |
101 |
102 def mainPublic(self, request, page_name=None, **kwargs): |
102 def mainPublic(self, request, page_name=None, **kwargs): |
103 """Displays the main site settings page. |
103 """Displays the main site settings page. |
104 |
104 |
105 Args: |
105 Args: |