mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-10 19:57:15 +03:00
Updated Django docs with latest changes in graphene-python PRs.
Including unmerged PR: https://github.com/graphql-python/graphene-python.org/pull/5
This commit is contained in:
parent
8f5a425859
commit
eef2841742
|
@ -70,7 +70,7 @@ with the context argument.
|
|||
def resolve_my_posts(self, args, context, info):
|
||||
# context will reference to the Django request
|
||||
if not context.user.is_authenticated():
|
||||
return []
|
||||
return Post.objects.none()
|
||||
else:
|
||||
return Post.objects.filter(owner=context.user)
|
||||
|
||||
|
@ -105,7 +105,6 @@ method to your ``DjangoObjectType``.
|
|||
except cls._meta.model.DoesNotExist:
|
||||
return None
|
||||
|
||||
if post.published or context.user is post.owner:
|
||||
if post.published or context.user == post.owner:
|
||||
return instance
|
||||
else:
|
||||
return None
|
||||
|
|
|
@ -110,7 +110,7 @@ For example:
|
|||
filter_fields = ['name', 'genus', 'is_domesticated']
|
||||
# Either a tuple/list of fields upon which ordering is allowed, or
|
||||
# True to allow filtering on all fields specified in filter_fields
|
||||
order_by_fields = True
|
||||
filter_order_by = True
|
||||
interfaces = (relay.Node, )
|
||||
|
||||
You can then control the ordering via the ``orderBy`` argument:
|
||||
|
@ -134,7 +134,7 @@ Custom Filtersets
|
|||
By default Graphene provides easy access to the most commonly used
|
||||
features of ``django-filter``. This is done by transparently creating a
|
||||
``django_filters.FilterSet`` class for you and passing in the values for
|
||||
``filter_fields`` and ``order_by_fields``.
|
||||
``filter_fields`` and ``filter_order_by``.
|
||||
|
||||
However, you may find this to be insufficient. In these cases you can
|
||||
create your own ``Filterset`` as follows:
|
||||
|
|
|
@ -32,6 +32,9 @@ you're ready to use Relay with Graphene GraphQL implementation.
|
|||
Advanced Usage
|
||||
--------------
|
||||
|
||||
The ``--indent`` option can be used to specify the number of indentation spaces to
|
||||
be used in the output. Defaults to `None` which displays all data on a single line.
|
||||
|
||||
To simplify the command to ``./manage.py graphql_schema``, you can
|
||||
specify the parameters in your settings.py:
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user