22 ] |
22 ] |
23 |
23 |
24 |
24 |
25 from soc.logic import works |
25 from soc.logic import works |
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 import soc.models.document |
31 import soc.models.document |
31 |
32 |
32 |
33 |
50 alt_response = simple.getAltResponseIfNotDeveloper(request, |
51 alt_response = simple.getAltResponseIfNotDeveloper(request, |
51 context=context) |
52 context=context) |
52 if alt_response: |
53 if alt_response: |
53 return alt_response |
54 return alt_response |
54 |
55 |
55 offset, limit = list_helpers.cleanListParameters( |
56 offset, limit = helpers.list.cleanListParameters( |
56 offset=request.GET.get('offset'), limit=request.GET.get('limit')) |
57 offset=request.GET.get('offset'), limit=request.GET.get('limit')) |
57 |
58 |
58 # Fetch one more to see if there should be a 'next' link |
59 # Fetch one more to see if there should be a 'next' link |
59 docs = works.getWorksForLimitAndOffset( |
60 docs = works.getWorksForLimitAndOffset( |
60 limit + 1, offset=offset, cls=soc.models.document.Document) |
61 limit + 1, offset=offset, cls=soc.models.document.Document) |
61 |
62 |
62 context['pagination_form'] = list_helpers.makePaginationForm(request, limit) |
63 context['pagination_form'] = helpers.list.makePaginationForm(request, limit) |
63 |
64 |
64 list_templates = {'list_main': 'soc/list/list_main.html', |
65 list_templates = {'list_main': 'soc/list/list_main.html', |
65 'list_pagination': 'soc/list/list_pagination.html', |
66 'list_pagination': 'soc/list/list_pagination.html', |
66 'list_row': 'soc/site/docs/list/docs_row.html', |
67 'list_row': 'soc/site/docs/list/docs_row.html', |
67 'list_heading': 'soc/site/docs/list/docs_heading.html'} |
68 'list_heading': 'soc/site/docs/list/docs_heading.html'} |
68 |
69 |
69 context = list_helpers.setList( |
70 context = helpers.list.setList( |
70 request, context, docs, |
71 request, context, docs, |
71 offset=offset, limit=limit, list_templates=list_templates) |
72 offset=offset, limit=limit, list_templates=list_templates) |
72 |
73 |
73 return response_helpers.respond(request, template, context) |
74 return response_helpers.respond(request, template, context) |