3 # Copyright 2008 the Melange authors. |
3 # Copyright 2008 the Melange authors. |
4 # |
4 # |
5 # Licensed under the Apache License, Version 2.0 (the "License"); |
5 # Licensed under the Apache License, Version 2.0 (the "License"); |
6 # you may not use this file except in compliance with the License. |
6 # you may not use this file except in compliance with the License. |
7 # You may obtain a copy of the License at |
7 # You may obtain a copy of the License at |
8 # |
8 # |
9 # http://www.apache.org/licenses/LICENSE-2.0 |
9 # http://www.apache.org/licenses/LICENSE-2.0 |
10 # |
10 # |
11 # Unless required by applicable law or agreed to in writing, software |
11 # Unless required by applicable law or agreed to in writing, software |
12 # distributed under the License is distributed on an "AS IS" BASIS, |
12 # distributed under the License is distributed on an "AS IS" BASIS, |
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 # See the License for the specific language governing permissions and |
14 # See the License for the specific language governing permissions and |
15 # limitations under the License. |
15 # limitations under the License. |
403 @decorators.merge_params |
403 @decorators.merge_params |
404 @decorators.check_access |
404 @decorators.check_access |
405 def list(self, request, access_type, |
405 def list(self, request, access_type, |
406 page_name=None, params=None, filter=None): |
406 page_name=None, params=None, filter=None): |
407 """Displays the list page for the entity type. |
407 """Displays the list page for the entity type. |
408 |
408 |
409 Args: |
409 Args: |
410 request: the standard Django HTTP request object |
410 request: the standard Django HTTP request object |
411 access_type : the name of the access type which should be checked |
411 access_type : the name of the access type which should be checked |
412 page_name: the page name displayed in templates as page and header title |
412 page_name: the page name displayed in templates as page and header title |
413 params: a dict with params for this View |
413 params: a dict with params for this View |
414 filter: a dict for the properties that the entities should have |
414 filter: a dict for the properties that the entities should have |
415 |
415 |
416 Params usage: |
416 Params usage: |
417 The params dictionary is passed as argument to getListContent in |
417 The params dictionary is passed as argument to getListContent in |
418 the soc.views.helper.list module. See the docstring for getListContent |
418 the soc.views.helper.list module. See the docstring for getListContent |
419 on how it uses it. The params dictionary is also passed as argument to |
419 on how it uses it. The params dictionary is also passed as argument to |
420 the _list method. See the docstring for _list on how it uses it. |
420 the _list method. See the docstring for _list on how it uses it. |
421 """ |
421 """ |
422 |
422 |
423 content = helper.lists.getListContent(request, params, filter) |
423 content = helper.lists.getListContent(request, params, filter) |
424 contents = [content] |
424 contents = [content] |
425 |
425 |
426 return self._list(request, params, contents, page_name) |
426 return self._list(request, params, contents, page_name) |
427 |
427 |
428 def _list(self, request, params, contents, page_name, context={}): |
428 def _list(self, request, params, contents, page_name, context=None): |
429 """Returns the list page for the specified contents. |
429 """Returns the list page for the specified contents. |
430 |
430 |
431 Args: |
431 Args: |
432 request: the standard Django HTTP request object |
432 request: the standard Django HTTP request object |
433 params: a dict with params for this View |
433 params: a dict with params for this View |
443 template can refer to it. |
443 template can refer to it. |
444 list_template: The list_template value is used as template for |
444 list_template: The list_template value is used as template for |
445 to display the list of all entities for this View. |
445 to display the list of all entities for this View. |
446 """ |
446 """ |
447 |
447 |
448 context = dicts.merge(context, |
448 context = dicts.merge(context, |
449 helper.responses.getUniversalContext(request)) |
449 helper.responses.getUniversalContext(request)) |
450 context['page_name'] = page_name |
450 context['page_name'] = page_name |
451 context['list'] = soc.logic.lists.Lists(contents) |
451 context['list'] = soc.logic.lists.Lists(contents) |
452 |
452 |
453 context['entity_type'] = params['name'] |
453 context['entity_type'] = params['name'] |
470 params: a dict with params for this View |
470 params: a dict with params for this View |
471 kwargs: The Key Fields for the specified entity |
471 kwargs: The Key Fields for the specified entity |
472 |
472 |
473 Params usage: |
473 Params usage: |
474 rights: The rights dictionary is used to check if the user has |
474 rights: The rights dictionary is used to check if the user has |
475 the required rights to delete the specified entity. See checkAccess |
475 the required rights to delete the specified entity. See checkAccess |
476 for more details on how the rights dictionary is used to check access |
476 for more details on how the rights dictionary is used to check access |
477 rights. |
477 rights. |
478 name: used in the same way as in edit(), see it's docstring for |
478 name: used in the same way as in edit(), see it's docstring for |
479 a more detailed explanation on how it is used. |
479 a more detailed explanation on how it is used. |
480 missing_redirect: see name |
480 missing_redirect: see name |
481 error_edit: see name |
481 error_edit: see name |