summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.co.uk>2016-11-28 14:46:51 (GMT)
committerGitHub <noreply@github.com>2016-11-28 14:46:51 (GMT)
commit2ece1c1fff57f584631bdec92984797462065902 (patch)
tree27a76bb0a1ad12bb8421c4fa9d08112384d58257
parent75ede3beddbba5ebb2a0693e7f4dfeb58dd5c0cb (diff)
downloaddjango-filter-2ece1c1fff57f584631bdec92984797462065902.zip
django-filter-2ece1c1fff57f584631bdec92984797462065902.tar.gz
django-filter-2ece1c1fff57f584631bdec92984797462065902.tar.bz2
Develop update (#574)
* README - add syntax highlighting Easier to read * Fixes typo in FiterSet docs Adds the missing letter "t" to DateRangeFiler.
-rw-r--r--README.rst22
-rw-r--r--docs/ref/filterset.txt2
2 files changed, 14 insertions, 10 deletions
diff --git a/README.rst b/README.rst
index ebb6537..9990599 100644
--- a/README.rst
+++ b/README.rst
@@ -19,11 +19,15 @@ Requirements
Installation
------------
-Install using pip::
+Install using pip:
+
+.. code-block:: sh
pip install django-filter
-Or clone the repo and add to your PYTHONPATH::
+Or clone the repo and add to your ``PYTHONPATH``:
+
+.. code-block:: sh
git clone git@github.com:carltongibson/django-filter.git
@@ -35,7 +39,7 @@ admin's ``list_filter`` interface. It has an API very similar to Django's
``ModelForms``. For example, if you had a Product model you could have a
filterset for it with the code:
-.. code:: python
+.. code-block:: python
import django_filters
@@ -47,16 +51,16 @@ filterset for it with the code:
And then in your view you could do:
-.. code:: python
+.. code-block:: python
def product_list(request):
filter = ProductFilter(request.GET, queryset=Product.objects.all())
return render(request, 'my_app/template.html', {'filter': filter})
-Django-filters additionally supports specifying FilterSet fields using a
-dictionary to specify filters with lookup types:
+Django-filters additionally supports specifying ``FilterSet`` fields using
+a dictionary to specify filters with lookup types:
-.. code:: python
+.. code-block:: python
import django_filters
@@ -67,8 +71,8 @@ dictionary to specify filters with lookup types:
'price': ['exact', 'gte', 'lte'],
}
-The filters will be available as 'name', 'name__icontains', 'price',
-'price__gte', and 'price__lte' in the above example.
+The filters will be available as ``'name'``, ``'name__icontains'``,
+``'price'``, ``'price__gte'``, and ``'price__lte'`` in the above example.
Support
-------
diff --git a/docs/ref/filterset.txt b/docs/ref/filterset.txt
index 409c07c..1753ec5 100644
--- a/docs/ref/filterset.txt
+++ b/docs/ref/filterset.txt
@@ -193,7 +193,7 @@ filters for a model field, you can override ``filter_for_lookup()``. Ex::
def filter_for_lookup(cls, f, lookup_type):
# override date range lookups
if isinstance(f, models.DateField) and lookup_type == 'range':
- return django_filters.DateRangeFiler, {}
+ return django_filters.DateRangeFilter, {}
# use default behavior otherwise
return super(ProductFilter, cls).filter_for_lookup(f, lookup_type)