/django-filter-mongoengine

A Django-filter for Mongoengine

Primary LanguagePython

Django Filter Monogoengine

Django-filter-mongoengine is a reusable Django application for allowing users to filter mongoengine querysets dynamically.

Full documentation on read the docs.

https://secure.travis-ci.org/alex/django-filter.png?branch=master

Requirements

  • Python 2.6+
  • Django 1.4.5+

Installation

Install using pip:

pip install django-filter-mongoengine

Or clone the repo and add to your PYTHONPATH:

git clone git@github.com:surfeurX/django-filter-mongoengine.git

Usage

import django_filters_mongoengine

class ProductFilter(django_filters_mongoengine.FilterSet):
    class Meta:
        model = Product
        fields = ['name', 'price', 'manufacturer']

And then in your view you could do:

def product_list(request):
    filter = ProductFilter(request.GET, queryset=Product.objects.all())
    return render_to_response('my_app/template.html', {'filter': filter})