from pysql import PySQL from local_settings import DATABASE db = PySQL(DATABASE.get('USER'),DATABASE.get('PASSWORD'),DATABASE.get('NAME'),DATABASE.get('HOST'),DATABASE.get('PORT')) p = Paginator(max_page_size=100,url='http://localhost:8000/users?dir=prev&last_seen=48&page=3&page_size=20',page_number=2,page_size=4, last_seen=49,direction='prev') print (p.get_order_by()) print (p.get_filter_data(),p.page_size) filter_data={ "state":{"$in":['closed','open']}, "operator":{"$sw":"s"}, #"message":{"$contains":"with"}, #"$or":[{"event_id":3},{"event_id":5}] #"$xor":[{"event_id":3},{"event_id":{"$gte":5}},{"event_id":{"$null":False}}] } #with joins