title: I am trying to do pagination in flask without html?Can anyone explain the process?
body: <p>This is my flask code for pagination and when i posted the url there 
     was error messages showing like</p>
  
  <p>start_copy = max(1, start - limit)
      TypeError: unsupported operand type(s) for -: 'pagination' and 'str'
   help me to solve this error!!</p>
  
  <pre><code>from flask import Flask, abort, request, jsonify
  
  
  from models import Categories
  
  from flask_restful import Resource
  
  app = Flask(__name__)
  
  class pagination(Resource):
  
      url= '/getbypages'
      start=1
      limit=20
      def get(start,limit):
          results = [1,2,3,4,5,6,7,8,9,10]
          print("resultsllllllllllll",results)
          count = len(results)
          obj = {}
          if count &lt; 1:
              print("404")
          else:
              #count = limit-start
              #print(count)
              obj['start'] = start
              obj['limit'] = limit
              obj['count'] = count
              print(obj)
              if start == 1:
                  obj['previous'] = ''
              else:
                  start_copy = max(1, start - limit)
                  print(start_copy)
                  limit_copy = start - 1
                  obj['previous'] = url + '?start=%d&amp;limit=%d' % (start_copy, limit_copy)
                  if start + limit &gt; count:
                      obj['next'] = ''
                  else:
                      start_copy = start + limit
                      obj['results'] = results[(start - 1):(start - 1 + limit)]
          return obj
      print(get(start, limit))
  </code></pre>