# HG changeset patch # User Sverre Rabbelier # Date 1237582966 0 # Node ID e6644c70e4087b00325b87181d02ea9c4dc29fb7 # Parent 8e8f45dd46e3ea37a2578ec0b53c925b053a2207 Show all orgs in accepted org list view Also cache the result for 15 minutes if all orgs have created their organization profile. Patch by: Sverre Rabbelier diff -r 8e8f45dd46e3 -r e6644c70e408 app/soc/views/models/program.py --- a/app/soc/views/models/program.py Fri Mar 20 21:02:21 2009 +0000 +++ b/app/soc/views/models/program.py Fri Mar 20 21:02:46 2009 +0000 @@ -55,6 +55,7 @@ from soc.views.models import sponsor as sponsor_view from soc.views.sitemap import sidebar +import soc.cache.logic import soc.logic.models.program import soc.models.work @@ -225,13 +226,25 @@ filter['status'] = ['new', 'active'] - from soc.views.models import organization as org_view - ao_params = org_view.view.getParams().copy() # active orgs + from soc.views.models.organization import view as org_view + ao_params = org_view.getParams().copy() # active orgs + ao_logic = ao_params['logic'] + + order = ['name'] - ao_params['list_action'] = (redirects.getPublicRedirect, ao_params) - ao_params['list_description'] = description + if aa_list: + fun = self._getData + else: + # only cache if all profiles are created + fun = soc.cache.logic.cache(self._getData) + entities = fun(ao_logic.getModel(), filter, order, ao_logic) - ao_list = lists.getListContent(request, ao_params, filter, idx=1) + ao_list = dicts.rename(ao_params, ao_params['list_params']) + ao_list['action'] = (redirects.getPublicRedirect, ao_params) + ao_list['description'] = description + ao_list['pagination'] = 'soc/list/no_pagination.html' + ao_list['data'] = entities + contents.append(ao_list) return self._list(request, params, contents, page_name)