22 ] |
22 ] |
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 from soc.views.helpers import list_helpers |
27 from soc.views import helpers |
|
28 import soc.views.helpers.list |
28 from soc.views.helpers import response_helpers |
29 from soc.views.helpers import response_helpers |
29 |
30 |
30 |
31 |
31 DEF_SITE_SPONSOR_LIST_ALL_TMPL = 'soc/group/list/all.html' |
32 DEF_SITE_SPONSOR_LIST_ALL_TMPL = 'soc/group/list/all.html' |
32 |
33 |
39 alt_response = simple.getAltResponseIfNotDeveloper(request, |
40 alt_response = simple.getAltResponseIfNotDeveloper(request, |
40 context=context) |
41 context=context) |
41 if alt_response: |
42 if alt_response: |
42 return alt_response |
43 return alt_response |
43 |
44 |
44 offset, limit = list_helpers.cleanListParameters( |
45 offset, limit = helpers.list.cleanListParameters( |
45 offset=request.GET.get('offset'), limit=request.GET.get('limit')) |
46 offset=request.GET.get('offset'), limit=request.GET.get('limit')) |
46 |
47 |
47 # Fetch one more to see if there should be a 'next' link |
48 # Fetch one more to see if there should be a 'next' link |
48 sponsors = sponsor.getSponsorsForLimitAndOffset(limit + 1, offset=offset) |
49 sponsors = sponsor.getSponsorsForLimitAndOffset(limit + 1, offset=offset) |
49 |
50 |
50 context['pagination_form'] = list_helpers.makePaginationForm(request, limit) |
51 context['pagination_form'] = helpers.list.makePaginationForm(request, limit) |
51 |
52 |
52 list_templates = {'list_main': 'soc/list/list_main.html', |
53 list_templates = {'list_main': 'soc/list/list_main.html', |
53 'list_pagination': 'soc/list/list_pagination.html', |
54 'list_pagination': 'soc/list/list_pagination.html', |
54 'list_row': 'soc/group/list/group_row.html', |
55 'list_row': 'soc/group/list/group_row.html', |
55 'list_heading': 'soc/group/list/group_heading.html'} |
56 'list_heading': 'soc/group/list/group_heading.html'} |
56 |
57 |
57 context = list_helpers.setList(request, context, sponsors, |
58 context = helpers.list.setList(request, context, sponsors, |
58 offset, limit, list_templates) |
59 offset, limit, list_templates) |
59 |
60 |
60 context['group_type'] = 'Sponsor' |
61 context['group_type'] = 'Sponsor' |
61 |
62 |
62 return response_helpers.respond(request, template, context) |
63 return response_helpers.respond(request, template, context) |