Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Mimicking the Django ORM queryset over rest framework api

Project Description
[![Build Status](https://travis-ci.org/variable/django-rest-framework-queryset.svg?branch=master)](https://travis-ci.org/variable/django-rest-framework-queryset)
# Django Rest Framework QuerySet
Mimicking the Django ORM queryset over rest framework api

## Usage:

### normal operation
```python
from rest_framework_queryset import RestFrameworkQuerySet
from django.core.paginator import Paginator

qs = RestFrameworkQuerySet('http://localhost:8082/api/')
qs.all()

# filter
boys = qs.filter(gender='boy')
girls = qs.filter(gender='girls')

# slicing
first_100_boys = boys[:100]

# pagination
p = Paginator(qs, 10)
print p.count
print p.num_pages
page1 = p.page(1)
```

### class based view
```python
from django.views.generic import ListView
from rest_framework_queryset import RestFrameworkQuerySet

class ListDataView(ListView):
paginate_by = 10
template_name = 'list.html'

def get_queryset(self, *args, **kwargs):
return RestFrameworkQuerySet('http://localhost:8082/api/').filter(**self.request.GET.dict())
```

## Dependencies
The queryset is dependent on the API that uses [LimiteOffsetPagination](http://www.django-rest-framework.org/api-guide/pagination/#limitoffsetpagination)
If you are using [PageNumberPagination](http://www.django-rest-framework.org/api-guide/pagination/#pagenumberpagination) then you can use the included `rest_framework_queryset.pagination.HybridPagination` which will switch pagination class depends on the query param is passed.
Release History

Release History

This version
History Node

0.0.15

History Node

0.0.14

History Node

0.0.13

History Node

0.0.12

History Node

0.0.11

History Node

0.0.10

History Node

0.0.9

History Node

0.0.8

History Node

0.0.7

History Node

0.0.6

History Node

0.0.5

History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-rest-framework-queryset-0.0.15.tar.gz (4.7 kB) Copy SHA256 Checksum SHA256 Source Oct 6, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting