Django-filter-mongoengine is a reusable Django application for allowing users to filter mongoengine querysets dynamically.
Full documentation on read the docs.
- Python 2.6+
- Django 1.4.5+
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
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})