'Determines the proper maximum number of results to return.
In order of importance, it will use:
* The user-requested ``limit`` from the GET parameters, if specified.
* The object-level ``limit`` if specified.
* ``settings.API_LIMIT_PER_PAGE`` if specified.
Default is 20 per page.'

def get_limit(self):

    limit = self.request_data.get(u'limit', self.limit)
    if (limit is None):
        limit = getattr(settings, u'API_LIMIT_PER_PAGE', 20)
    try:
        limit = int(limit)
    except ValueError:
        raise BadRequest((u"Invalid    limit    '%s'    provided.    Please    provide    a    positive    integer." % limit))
    if (limit < 0):
        raise BadRequest((u"Invalid    limit    '%s'    provided.    Please    provide    a    positive    integer    >=    0." % limit))
    if (self.max_limit and ((not limit) or (limit > self.max_limit))):
        return self.max_limit
    return limit
