mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-10 19:57:15 +03:00
Pin django-filter in filtering docs until full compatibility with 2.0.0
This commit is contained in:
parent
06ca766c38
commit
1c4182fd5d
|
@ -2,9 +2,9 @@ Filtering
|
|||
=========
|
||||
|
||||
Graphene integrates with
|
||||
`django-filter <https://django-filter.readthedocs.org>`__ to provide
|
||||
`django-filter <https://django-filter.readthedocs.io/en/1.1.0/>`__ (< 2.0.0) to provide
|
||||
filtering of results. See the `usage
|
||||
documentation <https://django-filter.readthedocs.io/en/latest/guide/usage.html#the-filter>`__
|
||||
documentation <https://django-filter.readthedocs.io/en/1.1.0/guide/usage.html#the-filter>`__
|
||||
for details on the format for ``filter_fields``.
|
||||
|
||||
This filtering is automatically available when implementing a ``relay.Node``.
|
||||
|
@ -15,7 +15,7 @@ You will need to install it manually, which can be done as follows:
|
|||
.. code:: bash
|
||||
|
||||
# You'll need to django-filter
|
||||
pip install django-filter
|
||||
pip install django-filter==1.1.0
|
||||
|
||||
Note: The techniques below are demoed in the `cookbook example
|
||||
app <https://github.com/graphql-python/graphene-django/tree/master/examples/cookbook>`__.
|
||||
|
@ -26,7 +26,7 @@ Filterable fields
|
|||
The ``filter_fields`` parameter is used to specify the fields which can
|
||||
be filtered upon. The value specified here is passed directly to
|
||||
``django-filter``, so see the `filtering
|
||||
documentation <https://django-filter.readthedocs.io/en/latest/guide/usage.html#the-filter>`__
|
||||
documentation <https://django-filter.readthedocs.io/en/1.1.0/guide/usage.html#the-filter>`__
|
||||
for full details on the range of options available.
|
||||
|
||||
For example:
|
||||
|
@ -127,7 +127,7 @@ create your own ``Filterset`` as follows:
|
|||
all_animals = DjangoFilterConnectionField(AnimalNode,
|
||||
filterset_class=AnimalFilter)
|
||||
|
||||
The context argument is passed on as the `request argument <http://django-filter.readthedocs.io/en/latest/guide/usage.html#request-based-filtering>`__
|
||||
The context argument is passed on as the `request argument <http://django-filter.readthedocs.io/en/1.1.0/guide/usage.html#request-based-filtering>`__
|
||||
in a ``django_filters.FilterSet`` instance. You can use this to customize your
|
||||
filters to be context-dependent. We could modify the ``AnimalFilter`` above to
|
||||
pre-filter animals owned by the authenticated user (set in ``context.user``).
|
||||
|
|
Loading…
Reference in New Issue
Block a user