89 patterns = [] |
89 patterns = [] |
90 patterns += [ |
90 patterns += [ |
91 (r'^%(url_name)s/(?P<access_type>assign_slots)/%(key_fields)s$', |
91 (r'^%(url_name)s/(?P<access_type>assign_slots)/%(key_fields)s$', |
92 'soc.views.models.%(module_name)s.assign_slots', |
92 'soc.views.models.%(module_name)s.assign_slots', |
93 'Assign slots'), |
93 'Assign slots'), |
|
94 (r'^%(url_name)s/(?P<access_type>slots)/%(key_fields)s$', |
|
95 'soc.views.models.%(module_name)s.slots', |
|
96 'Assign slots'), |
94 ] |
97 ] |
95 |
98 |
96 new_params['extra_django_patterns'] = patterns |
99 new_params['extra_django_patterns'] = patterns |
97 |
100 |
98 |
101 |
143 new_params['references'] = document_references |
146 new_params['references'] = document_references |
144 |
147 |
145 params = dicts.merge(params, new_params, sub_merge=True) |
148 params = dicts.merge(params, new_params, sub_merge=True) |
146 |
149 |
147 super(View, self).__init__(params=params) |
150 super(View, self).__init__(params=params) |
|
151 |
|
152 @decorators.merge_params |
|
153 @decorators.check_access |
|
154 def slots(self, request, acces_type, page_name=None, params=None, **kwargs): |
|
155 """Returns a JSON object with all orgs allocation. |
|
156 |
|
157 Args: |
|
158 request: the standard Django HTTP request object |
|
159 access_type : the name of the access type which should be checked |
|
160 page_name: the page name displayed in templates as page and header title |
|
161 params: a dict with params for this View, not used |
|
162 """ |
|
163 |
|
164 program = program_logic.logic.getFromKeyFields(kwargs) |
|
165 |
|
166 filter = { |
|
167 'scope': program, |
|
168 } |
|
169 |
|
170 query = org_logic.logic.getQueryForFields(filter=filter) |
|
171 entities = org_logic.logic.getAll(query) |
|
172 data = [i.toDict() for i in entities] |
|
173 |
|
174 return self.json(request, data) |
148 |
175 |
149 @decorators.merge_params |
176 @decorators.merge_params |
150 @decorators.check_access |
177 @decorators.check_access |
151 def assignSlots(self, request, access_type, page_name=None, |
178 def assignSlots(self, request, access_type, page_name=None, |
152 params=None, **kwargs): |
179 params=None, **kwargs): |
373 delete = decorators.view(view.delete) |
400 delete = decorators.view(view.delete) |
374 edit = decorators.view(view.edit) |
401 edit = decorators.view(view.edit) |
375 list = decorators.view(view.list) |
402 list = decorators.view(view.list) |
376 public = decorators.view(view.public) |
403 public = decorators.view(view.public) |
377 export = decorators.view(view.export) |
404 export = decorators.view(view.export) |
|
405 slots = decorators.view(view.slots) |
378 home = decorators.view(view.home) |
406 home = decorators.view(view.home) |
379 pick = decorators.view(view.pick) |
407 pick = decorators.view(view.pick) |