summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGermán Larraín <glarrain@users.noreply.github.com>2016-11-26 10:18:18 (GMT)
committerCarlton Gibson <carlton.gibson@noumenal.co.uk>2016-11-26 10:18:18 (GMT)
commit75ede3beddbba5ebb2a0693e7f4dfeb58dd5c0cb (patch)
tree7d7ecf5a04b8423288c94a9937cf5bfec31eb663
parentd5516f9828fd7ab5e59359ad6ade5fa5bcbbb949 (diff)
downloaddjango-filter-75ede3beddbba5ebb2a0693e7f4dfeb58dd5c0cb.zip
django-filter-75ede3beddbba5ebb2a0693e7f4dfeb58dd5c0cb.tar.gz
django-filter-75ede3beddbba5ebb2a0693e7f4dfeb58dd5c0cb.tar.bz2
README: add syntax highlighting (#572)
-rw-r--r--README.rst12
1 files changed, 9 insertions, 3 deletions
diff --git a/README.rst b/README.rst
index e5fe804..ebb6537 100644
--- a/README.rst
+++ b/README.rst
@@ -33,7 +33,9 @@ Usage
Django-filter can be used for generating interfaces similar to the Django
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::
+filterset for it with the code:
+
+.. code:: python
import django_filters
@@ -43,14 +45,18 @@ filterset for it with the code::
fields = ['name', 'price', 'manufacturer']
-And then in your view you could do::
+And then in your view you could do:
+
+.. code:: 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::
+dictionary to specify filters with lookup types:
+
+.. code:: python
import django_filters