def _activities_limit(q, limit, offset=None):
 import ckan.model as model
 q = q.order_by(desc(model.Activity.timestamp))
 if offset:
  q = q.offset(offset)
 if limit:
  q = q.limit(limit)
 return q

def _activities_limit ( q , limit , offset = None ) : import ckan . model as model q = q . order_by ( desc ( model . Activity . timestamp ) ) if offset : q = q . offset ( offset ) if limit : q = q . limit ( limit ) return q
return an sqlalchemy query for all activities at an offset with a limit .