40 |
40 |
41 class View(base.View): |
41 class View(base.View): |
42 """View methods for the Sponsor model. |
42 """View methods for the Sponsor model. |
43 """ |
43 """ |
44 |
44 |
45 def __init__(self, original_params=None): |
45 def __init__(self, params=None): |
46 """Defines the fields and methods required for the base View class |
46 """Defines the fields and methods required for the base View class |
47 to provide the user with list, public, create, edit and delete views. |
47 to provide the user with list, public, create, edit and delete views. |
48 |
48 |
49 Params: |
49 Params: |
50 original_params: a dict with params for this View |
50 params: a dict with params for this View |
51 """ |
51 """ |
52 |
52 |
53 params = {} |
53 new_params = {} |
54 params['logic'] = soc.logic.models.program.logic |
54 new_params['logic'] = soc.logic.models.program.logic |
55 |
55 |
56 params['name'] = "Program" |
56 new_params['name'] = "Program" |
57 params['name_short'] = "Program" |
57 new_params['name_short'] = "Program" |
58 params['name_plural'] = "Programs" |
58 new_params['name_plural'] = "Programs" |
59 params['url_name'] = "program" |
59 new_params['url_name'] = "program" |
60 params['module_name'] = "program" |
60 new_params['module_name'] = "program" |
61 |
61 |
62 params['extra_dynaexclude'] = ['home'] |
62 new_params['extra_dynaexclude'] = ['home'] |
63 params['create_extra_dynafields'] = { |
63 new_params['create_extra_dynafields'] = { |
64 'description': forms.fields.CharField(widget=helper.widgets.TinyMCE( |
64 'description': forms.fields.CharField(widget=helper.widgets.TinyMCE( |
65 attrs={'rows':10, 'cols':40})), |
65 attrs={'rows':10, 'cols':40})), |
66 'scope_path': forms.CharField(widget=forms.HiddenInput, |
66 'scope_path': forms.CharField(widget=forms.HiddenInput, |
67 required=False), |
67 required=False), |
68 'clean_link_id': cleaning.clean_link_id, |
68 'clean_link_id': cleaning.clean_link_id, |
69 } |
69 } |
70 |
70 |
71 params = dicts.merge(original_params, params) |
71 params = dicts.merge(params, new_params) |
72 |
72 |
73 base.View.__init__(self, params=params) |
73 super(View, self).__init__(params=params) |
74 |
74 |
75 def create(self, request, **kwargs): |
75 def create(self, request, **kwargs): |
76 """Specialized create view to enforce needing a scope_path |
76 """Specialized create view to enforce needing a scope_path |
77 |
77 |
78 This view simply gives control to the base.View.create if the |
78 This view simply gives control to the base.View.create if the |