0

My code

class PointHandlerDynamic(BaseHandler):
    model = Points
    fields = ('Point_ID', 'X_Coor', 'Y_Coor', 'Seat_ID_ID')


   def Seat_ID_ID(self, instance):
      return instance.Sear_ID.ID

   def read(self, name=None):
      cursor = connection.cursor()        
      //page=1, offset 4000
      cursor.execute("select Point_ID,Seat_ID,X_Coor,Y_Coor,Seats.Color,Seats.Caption,Seats.Tier,Seats.Area,Seats.Booked,Prices.Price from Points,Seats,Prices where Seat_ID = Seats.ID and Seats.Color = Prices.Color")
       transaction.commit_unless_managed()
       row = cursor.fetchall()
       return row

I want when ajax call handler.py, ajax will encrease 'page'.

Rohan
  • 52,392
  • 12
  • 90
  • 87
Hueston Rido
  • 809
  • 1
  • 11
  • 16

1 Answers1

0

By default the BaseHandler read() method accepts more arguments:

def read(self, request, *args, **kwargs):

So you probably would want to use the request.GET elements for paging. You could then pass the LIMIT and OFFSET values from your request to the SQL query.

I am not sure what are you trying to achieve but it looks to me that you could probably use the django ORM to retrieve the data instead of using connection and cursor, your query doesn't look too complicated. Also your question is hard to understand but I assume what you need is some sort of pagination.

Ania Warzecha
  • 1,796
  • 13
  • 26