app/soc/views/site/sponsor/list.py
changeset 268 af1d7f48b361
parent 267 0c008a43443b
child 272 00cea07656c0
equal deleted inserted replaced
267:0c008a43443b 268:af1d7f48b361
    23 
    23 
    24 
    24 
    25 from soc.logic import sponsor
    25 from soc.logic import sponsor
    26 from soc.views import simple
    26 from soc.views import simple
    27 
    27 
    28 from soc.views import helpers
    28 from soc.views import helper
    29 import soc.views.helpers.list
    29 import soc.views.helper.lists
    30 from soc.views.helpers import response_helpers
    30 from soc.views.helpers import response_helpers
    31 
    31 
    32 
    32 
    33 DEF_SITE_SPONSOR_LIST_ALL_TMPL = 'soc/group/list/all.html'
    33 DEF_SITE_SPONSOR_LIST_ALL_TMPL = 'soc/group/list/all.html'
    34 
    34 
    41   alt_response = simple.getAltResponseIfNotDeveloper(request,
    41   alt_response = simple.getAltResponseIfNotDeveloper(request,
    42                                                      context=context)
    42                                                      context=context)
    43   if alt_response:
    43   if alt_response:
    44     return alt_response  
    44     return alt_response  
    45   
    45   
    46   offset, limit = helpers.list.cleanListParameters(
    46   offset, limit = helper.lists.cleanListParameters(
    47       offset=request.GET.get('offset'), limit=request.GET.get('limit'))
    47       offset=request.GET.get('offset'), limit=request.GET.get('limit'))
    48   
    48   
    49   # Fetch one more to see if there should be a 'next' link
    49   # Fetch one more to see if there should be a 'next' link
    50   sponsors = sponsor.getSponsorsForLimitAndOffset(limit + 1, offset=offset)
    50   sponsors = sponsor.getSponsorsForLimitAndOffset(limit + 1, offset=offset)
    51 
    51 
    52   context['pagination_form'] = helpers.list.makePaginationForm(request, limit)
    52   context['pagination_form'] = helper.lists.makePaginationForm(request, limit)
    53   
    53   
    54   list_templates = {'list_main': 'soc/list/list_main.html',
    54   list_templates = {'list_main': 'soc/list/list_main.html',
    55                     'list_pagination': 'soc/list/list_pagination.html',
    55                     'list_pagination': 'soc/list/list_pagination.html',
    56                     'list_row': 'soc/group/list/group_row.html',
    56                     'list_row': 'soc/group/list/group_row.html',
    57                     'list_heading': 'soc/group/list/group_heading.html'}
    57                     'list_heading': 'soc/group/list/group_heading.html'}
    58                       
    58                       
    59   context = helpers.list.setList(request, context, sponsors, 
    59   context = helper.lists.setList(request, context, sponsors, 
    60                                  offset, limit, list_templates)
    60                                  offset, limit, list_templates)
    61                                  
    61                                  
    62   context['group_type'] = 'Sponsor'
    62   context['group_type'] = 'Sponsor'
    63 
    63 
    64   return response_helpers.respond(request, template, context)
    64   return response_helpers.respond(request, template, context)