Updated list to use the new order in getForFields.
Patch by: Lennard de Rijk
Reviewed by: to-be-reviewed
--- a/app/soc/views/helper/lists.py Wed Mar 04 22:11:26 2009 +0000
+++ b/app/soc/views/helper/lists.py Wed Mar 04 22:24:45 2009 +0000
@@ -100,13 +100,15 @@
return request.path + link_suffix
-def getListContent(request, params, filter=None, idx=0, need_content=False):
+def getListContent(request, params, filter=None, order=None,
+ idx=0, need_content=False):
"""Returns a dict with fields used for rendering lists.
Args:
request: the Django HTTP request object
params: a dict with params for the View this list belongs to
filter: a filter for this list
+ order: the order which should be used for the list (in getForFields format)
idx: the index of this list
need_content: iff True will return None if there is no data
@@ -137,7 +139,8 @@
pagination_form = makePaginationForm(request, limit, limit_key)
# Fetch one more to see if there should be a 'next' link
- data = logic.getForFields(filter=filter, limit=limit+1, offset=offset)
+ data = logic.getForFields(filter=filter, limit=limit+1, offset=offset,
+ order=order)
if need_content and not data:
return None
--- a/app/soc/views/models/base.py Wed Mar 04 22:11:26 2009 +0000
+++ b/app/soc/views/models/base.py Wed Mar 04 22:24:45 2009 +0000
@@ -461,7 +461,7 @@
@decorators.merge_params
@decorators.check_access
def list(self, request, access_type,
- page_name=None, params=None, filter=None, **kwargs):
+ page_name=None, params=None, filter=None, order=None, **kwargs):
"""Displays the list page for the entity type.
Args:
@@ -478,7 +478,7 @@
the _list method. See the docstring for _list on how it uses it.
"""
- content = helper.lists.getListContent(request, params, filter)
+ content = helper.lists.getListContent(request, params, filter, order=order)
contents = [content]
return self._list(request, params, contents, page_name)
--- a/app/soc/views/models/group.py Wed Mar 04 22:11:26 2009 +0000
+++ b/app/soc/views/models/group.py Wed Mar 04 22:24:45 2009 +0000
@@ -266,7 +266,7 @@
"An overview of the %(name)s's incoming requests." % params)
inc_req_content = list_helper.getListContent(
- request, inc_req_params, filter, 0)
+ request, inc_req_params, filter, idx=0)
# list all outstanding invites
filter = {
@@ -284,7 +284,7 @@
"An overview of the %(name)s's outstanding invites." % params)
out_inv_content = list_helper.getListContent(
- request, out_inv_params, filter, 1)
+ request, out_inv_params, filter, idx=1)
# list all ignored requests
filter = {
@@ -302,7 +302,7 @@
"An overview of the %(name)s's ignored requests." % params)
ignored_content = list_helper.getListContent(
- request, ignored_params, filter, 2)
+ request, ignored_params, filter, idx=2)
contents = [inc_req_content, out_inv_content, ignored_content]
@@ -352,7 +352,7 @@
list_params['name_plural'], params['name']))
new_list_content = list_helper.getListContent(
- request, list_params, filter, index)
+ request, list_params, filter, idx=index)
contents += [new_list_content]
--- a/app/soc/views/models/group_app.py Wed Mar 04 22:11:26 2009 +0000
+++ b/app/soc/views/models/group_app.py Wed Mar 04 22:24:45 2009 +0000
@@ -192,7 +192,7 @@
list_params['list_action'] = choice[1]
list_content = list_helper.getListContent(
- request, list_params, filter, index)
+ request, list_params, filter, idx=index)
contents += [list_content]
--- a/app/soc/views/models/notification.py Wed Mar 04 22:11:26 2009 +0000
+++ b/app/soc/views/models/notification.py Wed Mar 04 22:24:45 2009 +0000
@@ -134,7 +134,7 @@
# TODO(Lennard) when list sorting is implemented sort on descending date
un_list = list_helper.getListContent(
- request, un_params, filter, 0)
+ request, un_params, filter, idx=0)
# Now get the read list
@@ -148,7 +148,7 @@
"An overview of your read Notifications.")
rn_list = list_helper.getListContent(
- request, rn_params, filter, 1)
+ request, rn_params, filter, idx=1)
# fill contents with all the needed lists
contents = [un_list, rn_list]
--- a/app/soc/views/models/request.py Wed Mar 04 22:11:26 2009 +0000
+++ b/app/soc/views/models/request.py Wed Mar 04 22:24:45 2009 +0000
@@ -207,7 +207,7 @@
"An overview of your unhandled invites.")
uh_list = helper.lists.getListContent(
- request, uh_params, filter, 0)
+ request, uh_params, filter, idx=0)
# construct the Open Requests list
@@ -221,7 +221,7 @@
"List of your pending requests.")
ar_list = helper.lists.getListContent(
- request, ar_params, filter, 1)
+ request, ar_params, filter, idx=1)
# fill contents with all the needed lists
contents = [uh_list, ar_list]
--- a/app/soc/views/models/user_self.py Wed Mar 04 22:11:26 2009 +0000
+++ b/app/soc/views/models/user_self.py Wed Mar 04 22:24:45 2009 +0000
@@ -249,7 +249,8 @@
list_params['list_action'] = (redirects.getEditRedirect, list_params)
list_params['list_description'] = self.DEF_ROLE_LIST_MSG_FMT % list_params
- list = helper.lists.getListContent(request, list_params, filter, i, True)
+ list = helper.lists.getListContent(request, list_params, filter,
+ idx=i, need_content=True)
if list:
contents.append(list)