You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

filter-and-pagination

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filter-and-pagination

Filter and Pagination in Django

1.1.14
pipPyPI
Maintainers
1

Filter & Pagination in Django

  • Filter your result-set
  • Paginate your result-set as per object you want in your response
  • It's a open source service.
  • Easy to implement
  • Fastest execution & High performance

Install with pip

pip install filter-and-pagination

Upgrade with pip

pip install filter-and-pagination --upgrade

How to implement

  • install package by pip install filter-and-pagination
  • import FilterPagination by from filter_and_pagination import FilterPagination in view.py
  • in your function writte code as bellow standards...
queryset = FilterPagination.filter_and_pagination(request, Customer)
serialize_data = CustomerSerializer(queryset['queryset'], many=True).data
resultset = {'dataset': serialize_data, 'pagination': queryset['pagination']}
  • in this code Customer is Django model &
  • CustomerSerializer is a DRF Serializer class
  • in the resultset it contains dataset & pagination data, In this format (API Response) link: https://github.com/ashish1997it/filter-pagination-dj#demo
  • For the API request follow PostMan collection link: https://github.com/ashish1997it/filter-pagination-dj#postman in the header section it will take a parameter & request you customize as per your requirement

Demo / Example

Request:

Response:

{
	"status_code": 200,
	"status": "success",
	"message": [
		"Customer data retrieved successfully."
	],
	"data": {
		"dataset": [{
			"id": 166,
			"name": "Jasmin",
			"full_name": "Jasmin Perry",
			"email": "nicolemathews@smith-anderson.net",
			"contact_no_dail_code": "186",
			"contact_no": "9831999092",
			"dob": "1936-07-27",
			"gender": 1,
			"address": "466 Zuniga Trail Suite 955\nLake Brandonside, AL 22894",
			"extra": {},
			"created_at": "2020-01-11T10:09:24.780734Z",
			"updated_at": "2020-01-11T10:09:24.780745Z"
		}],
		"pagination": {
			"per_page": 20,
			"current_page": 1,
			"total_count": 1,
			"total_pages": 1
		}
	}
}

PyPi

GitHub

PostMan

Run in Postman

Medium

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts