app/soc/views/site/docs/list.py
changeset 263 9b39d93b677f
parent 234 a019afb4b80f
child 265 3c2994f3b85f
equal deleted inserted replaced
262:52a42831d9d6 263:9b39d93b677f
    20 __authors__ = [
    20 __authors__ = [
    21   '"Todd Larsen" <tlarsen@google.com>',
    21   '"Todd Larsen" <tlarsen@google.com>',
    22   ]
    22   ]
    23 
    23 
    24 
    24 
    25 from soc.logic import document
    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.helpers import list_helpers
    28 from soc.views.helpers import response_helpers
    28 from soc.views.helpers import response_helpers
    29 
    29 
    30 import soc.models.document
    30 import soc.models.document
    54   
    54   
    55   offset = request.GET.get('offset')
    55   offset = request.GET.get('offset')
    56   limit = request.GET.get('limit')
    56   limit = request.GET.get('limit')
    57 
    57 
    58   offset, limit = list_helpers.getListParemeters(offset=offset, limit=limit)
    58   offset, limit = list_helpers.getListParemeters(offset=offset, limit=limit)
    59   
    59 
    60   docs = document.getWorksForOffsetAndLimit(
    60   # Fetch one more to see if there should be a 'next' link
    61       offset=offset, limit=limit, cls=soc.models.document.Document)
    61   docs = works.getWorksForLimitAndOffset(
       
    62       limit + 1, offset=offset, cls=soc.models.document.Document)
       
    63 
       
    64   # TODO(tlarsen): uncomment when pagination select control is working.
       
    65   # form = list_helpers.makeSelectNumItemsForm(request, limit)
       
    66   # context['form'] = form
    62 
    67 
    63   list_templates = {'list_main': 'soc/list/list_main.html',
    68   list_templates = {'list_main': 'soc/list/list_main.html',
    64                     'list_pagination': 'soc/list/list_pagination.html',
    69                     'list_pagination': 'soc/list/list_pagination.html',
    65                     'list_row': 'soc/site/docs/list/docs_row.html',
    70                     'list_row': 'soc/site/docs/list/docs_row.html',
    66                     'list_heading': 'soc/site/docs/list/docs_heading.html'}
    71                     'list_heading': 'soc/site/docs/list/docs_heading.html'}