app/soc/views/helper/lists.py
changeset 1459 2584724403ff
parent 1308 35b75ffcbb37
child 1604 297444daac68
equal deleted inserted replaced
1458:ec06d3ee73e4 1459:2584724403ff
    98   link_suffix = '?' + '&'.join(args)
    98   link_suffix = '?' + '&'.join(args)
    99 
    99 
   100   return request.path + link_suffix
   100   return request.path + link_suffix
   101 
   101 
   102 
   102 
   103 def getListContent(request, params, filter=None, idx=0):
   103 def getListContent(request, params, filter=None, idx=0, need_content=False):
   104   """Returns a dict with fields used for rendering lists.
   104   """Returns a dict with fields used for rendering lists.
   105 
   105 
   106   Args:
   106   Args:
   107     request: the Django HTTP request object
   107     request: the Django HTTP request object
   108     params: a dict with params for the View this list belongs to
   108     params: a dict with params for the View this list belongs to
   136   pagination_form = makePaginationForm(request, limit, limit_key)
   136   pagination_form = makePaginationForm(request, limit, limit_key)
   137 
   137 
   138   # Fetch one more to see if there should be a 'next' link
   138   # Fetch one more to see if there should be a 'next' link
   139   data = logic.getForFields(filter=filter, limit=limit+1, offset=offset)
   139   data = logic.getForFields(filter=filter, limit=limit+1, offset=offset)
   140 
   140 
       
   141   if need_content and not data:
       
   142     return None
       
   143 
   141   more = len(data) > limit
   144   more = len(data) > limit
   142 
   145 
   143   if more:
   146   if more:
   144     del data[limit:]
   147     del data[limit:]
   145 
   148