File tree Expand file tree Collapse file tree 2 files changed +1
-40
lines changed Expand file tree Collapse file tree 2 files changed +1
-40
lines changed Original file line number Diff line number Diff line change @@ -91,50 +91,13 @@ Which you could query as follows:
91
91
}
92
92
}
93
93
94
- Orderable fields
95
- ----------------
96
-
97
- Ordering can also be specified using ``filter_order_by ``. Like
98
- ``filter_fields ``, this value is also passed directly to
99
- ``django-filter `` as the ``order_by `` field. For full details see the
100
- `order\_ by
101
- documentation <https://django-filter.readthedocs.org/en/latest/usage.html#ordering-using-order-by> `__.
102
-
103
- For example:
104
-
105
- .. code :: python
106
-
107
- class AnimalNode (DjangoObjectType ):
108
- class Meta :
109
- model = Animal
110
- filter_fields = [' name' , ' genus' , ' is_domesticated' ]
111
- # Either a tuple/list of fields upon which ordering is allowed, or
112
- # True to allow filtering on all fields specified in filter_fields
113
- filter_order_by = True
114
- interfaces = (relay.Node, )
115
-
116
- You can then control the ordering via the ``orderBy `` argument:
117
-
118
- .. code ::
119
-
120
- query {
121
- allAnimals(orderBy: "name") {
122
- edges {
123
- node {
124
- id,
125
- name
126
- }
127
- }
128
- }
129
- }
130
-
131
94
Custom Filtersets
132
95
-----------------
133
96
134
97
By default Graphene provides easy access to the most commonly used
135
98
features of ``django-filter ``. This is done by transparently creating a
136
99
``django_filters.FilterSet `` class for you and passing in the values for
137
- ``filter_fields `` and `` filter_order_by `` .
100
+ ``filter_fields ``.
138
101
139
102
However, you may find this to be insufficient. In these cases you can
140
103
create your own ``Filterset `` as follows:
Original file line number Diff line number Diff line change @@ -98,7 +98,6 @@ Create ``cookbook/ingredients/schema.py`` and type the following:
98
98
class Meta :
99
99
model = Category
100
100
filter_fields = [' name' , ' ingredients' ]
101
- filter_order_by = [' name' ]
102
101
interfaces = (relay.Node, )
103
102
104
103
@@ -112,7 +111,6 @@ Create ``cookbook/ingredients/schema.py`` and type the following:
112
111
' category' : [' exact' ],
113
112
' category__name' : [' exact' ],
114
113
}
115
- filter_order_by = [' name' , ' category__name' ]
116
114
interfaces = (relay.Node, )
117
115
118
116
You can’t perform that action at this time.
0 commit comments