Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/filtering.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ for details on the format for ``filter_fields``.
This filtering is automatically available when implementing a ``relay.Node``.
Additionally ``django-filter`` is an optional dependency of Graphene.

You will need to install it manually, which can be done as follows:
You can install it as follows:

.. code:: bash

# You'll need to install django-filter
pip install django-filter>=2
# Install graphene-django with django-filter support.
pip install "graphene-django[filter]"

After installing ``django-filter`` you'll need to add the application in the ``settings.py`` file:

Expand Down
11 changes: 3 additions & 8 deletions docs/tutorial-relay.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ We will setup the project, create the following:
virtualenv env
source env/bin/activate # On Windows use `env\Scripts\activate`

# Install Django and Graphene with Django support
pip install django
pip install graphene_django
# Install Django and Graphene with django-filter support
pip install django "graphene_django[filter]"

# Set up a new project with a single application
django-admin.py startproject cookbook . # Note the trailing '.' character
Expand Down Expand Up @@ -165,11 +164,7 @@ The filtering functionality is provided by
documentation <https://django-filter.readthedocs.org/en/latest/guide/usage.html#the-filter>`__
for details on the format for ``filter_fields``. While optional, this
tutorial makes use of this functionality so you will need to install
``django-filter`` for this tutorial to work:

.. code:: bash

pip install django-filter
``django-filter`` for this tutorial to work.

Note that the above ``Query`` class is marked as 'abstract'. This is
because we will now create a project-level query which will combine all
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/filter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
if not DJANGO_FILTER_INSTALLED:
warnings.warn(
"Use of django filtering requires the django-filter package "
"be installed. You can do so using `pip install django-filter`",
"be installed. You can do so using `pip install 'graphene-django[filter]'`",
ImportWarning,
)
else:
Expand Down
27 changes: 16 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,23 @@
ast.literal_eval(_version_re.search(f.read().decode("utf-8")).group(1))
)

rest_framework_require = ["djangorestframework>=3.6.3"]
filter_require = ["django-filter>=22.1"]

rest_framework_require = ["djangorestframework>=3.6.3"]

tests_require = [
"pytest>=7.3.1",
"pytest-cov",
"pytest-random-order",
"coveralls",
"mock",
"pytz",
"django-filter>=22.1",
"pytest-django>=4.5.2",
] + rest_framework_require
tests_require = (
[
"pytest>=7.3.1",
"pytest-cov",
"pytest-random-order",
"coveralls",
"mock",
"pytz",
"pytest-django>=4.5.2",
]
+ filter_require
+ rest_framework_require
)


dev_requires = [
Expand Down Expand Up @@ -73,6 +77,7 @@
rest_framework_require=rest_framework_require,
extras_require={
"test": tests_require,
"filter": filter_require,
"rest_framework": rest_framework_require,
"dev": dev_requires,
},
Expand Down
Loading