Skip to content

Commit 51ff609

Browse files
author
Ernesto Perez Amigo
committed
Update documentation in README
1 parent fbbd637 commit 51ff609

File tree

1 file changed

+31
-25
lines changed

1 file changed

+31
-25
lines changed

README.md

+31-25
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
This package add some extra functionalities to graphene-django to facilitate the graphql use without Relay:
88
1. Allow pagination and filtering on Queries.
99
2. Allow to define DjangoRestFramework serializers based Mutations.
10-
3. Add support to Subscription's requests and its integration with websockets using Channels package.
10+
3. Add support to Subscription's requests and its integration with websockets using Channels package. :muscle:
1111

1212
## Installation
1313

@@ -33,7 +33,7 @@ pip install graphene-django-extras
3333
1. DjangoListObjectType (*Recommended for Types definition*)
3434
2. DjangoInputObjectType
3535

36-
**Paginations:**
36+
**Paginations:**
3737
1. LimitOffsetGraphqlPagination
3838
2. PageGraphqlPagination
3939
3. CursorGraphqlPagination (*coming soon*)
@@ -93,7 +93,7 @@ class UserInput(DjangoInputObjectType):
9393
```python
9494
import graphene
9595
from graphene_django_extras import DjangoSerializerMutation
96-
96+
9797
from .serializers import UserSerializer
9898
from .types import UserType
9999
from .input_types import UserInputType
@@ -130,7 +130,8 @@ class UserMutation(graphene.Mutation):
130130

131131
```python
132132
import graphene
133-
from graphene_django_extras import DjangoObjectField, DjangoListObjectField, DjangoFilterPaginateListField, DjangoFilterListField, LimitOffsetGraphqlPagination
133+
from graphene_django_extras import DjangoObjectField, DjangoListObjectField, DjangoFilterPaginateListField,
134+
DjangoFilterListField, LimitOffsetGraphqlPagination
134135
from .types import UserType, UserListType
135136
from .mutations import UserMutation, UserSerializerMutation
136137

@@ -143,7 +144,7 @@ class Queries(graphene.ObjectType):
143144
all_users3 = DjangoListObjectField(UserListType, filterset_class=UserFilter, description=_('All Users query'))
144145

145146
# Defining a query for a single user
146-
# The DjangoObjectField have a ID input field, that allow filter by id and is't necessary resolve method definition
147+
# The DjangoObjectField have a ID input field, that allow filter by id and is't necessary resolve method
147148
user = DjangoObjectField(UserType, description=_('Single User query'))
148149

149150
# Another way to define a single user query
@@ -294,7 +295,7 @@ class RootQuery(custom.app.route.graphql.schema.Query, graphene.ObjectType):
294295
class Meta:
295296
description = 'Root Queries for my Project'
296297

297-
298+
298299
class RootSubscription(custom.app.route.graphql.schema.Mutation, graphene.ObjectType):
299300
class Meta:
300301
description = 'Root Mutations for my Project'
@@ -326,7 +327,7 @@ from .graphql.subscriptions import UserSubscription, GroupSubscription
326327
class CustomAppDemultiplexer(GraphqlAPIDemultiplexer):
327328
consumers = {
328329
'users': UserSubscription.get_binding().consumer,
329-
'groups': GroupSubscription.get_binding().consumer
330+
'groups': GroupSubscription.get_binding().consumer
330331
}
331332

332333

@@ -382,15 +383,15 @@ When the connection is established, the server return a websocket message like t
382383
The Subscription accept five possible parameters:
383384
1. **operation**: Operation to perform: subscribe or unsubscribe. (*required*)
384385
2. **action**: Action you wish to subscribe: create, update, delete or all_actions. (*required*)
385-
3. **channelId**: Websocket connection identification. (*required*)
386-
4. **id**: ID field value of model object that you wish to subscribe to. (*optional*)
387-
5. **data**: List of desired model fields that you want in subscription's notification. (*optional*)
386+
3. **channelId**: Websocket connection identification. (*required*)
387+
4. **id**: ID field value of model object that you wish to subscribe to. (*optional*)
388+
5. **data**: List of desired model fields that you want in subscription's notification. (*optional*)
388389

389390
```js
390391
subscription{
391392
userSubscription(
392-
action: UPDATE,
393-
operation: SUBSCRIBE,
393+
action: UPDATE,
394+
operation: SUBSCRIBE,
394395
channelId: "GthKdsYVrK!WxRCdJQMPi",
395396
id: 5,
396397
data: [ID, USERNAME, FIRST_NAME, LAST_NAME, EMAIL, IS_SUPERUSER]
@@ -409,16 +410,16 @@ In this case, the subscription request sanded return a websocket message to clie
409410
"stream": "users",
410411
"payload": {
411412
"action": "update",
412-
"model": "auth.user",
413+
"model": "auth.user",
413414
"data": {
414415
"id": 5,
415416
"username": "meaghan90",
416-
"first_name": "Meaghan",
417-
"last_name": "Ackerman",
418-
"email": "[email protected]",
419-
"is_superuser": false
417+
"first_name": "Meaghan",
418+
"last_name": "Ackerman",
419+
"email": "[email protected]",
420+
"is_superuser": false
420421
}
421-
}
422+
}
422423
}
423424
```
424425

@@ -427,8 +428,8 @@ For unsubscribe you must send a graphql subscription request like this:
427428
```js
428429
subscription{
429430
userSubscription(
430-
action: UPDATE,
431-
operation: UNSUBSCRIBE,
431+
action: UPDATE,
432+
operation: UNSUBSCRIBE,
432433
channelId: "GthKdsYVrK!WxRCdJQMPi",
433434
id: 5
434435
){
@@ -445,9 +446,11 @@ subscription{
445446
## Change Log:
446447

447448
#### v0.1.0-alpha1:
448-
1. Added support to multiselect choices values for models.CharField with choices attribute, on queries and mutations. Example: Integration with django-multiselectfield package.
449+
1. Added support to multiselect choices values for models.CharField with choices attribute,
450+
on queries and mutations. Example: Integration with django-multiselectfield package.
449451
2. Added support to GenericForeignKey and GenericRelation fields, on queries and mutations.
450-
3. Added first approach to support Subscriptions with Channels, with subscribe and unsubscribe operations. Using channels-api package. :muscle:
452+
3. Added first approach to support Subscriptions with Channels, with subscribe and unsubscribe operations.
453+
Using channels-api package.
451454
4. Fixed minors bugs.
452455

453456
#### v0.0.4:
@@ -461,8 +464,10 @@ subscription{
461464

462465
#### v0.0.1:
463466
1. Fixed bug on DjangoInputObjectType class that refer to unused interface attribute.
464-
2. Added support to create nested objects like in DRF (http://www.django-rest-framework.org/api-guide/serializers/#writable-nested-representations), it's valid to SerializerMutation and DjangoInputObjectType, only is necessary to specify nested_fields=True on its Meta class definition.
465-
3. Added support to show, only in mutations types to create objects and with debug=True on settings, inputs autocomplete ordered by required fields first.
467+
2. Added support to create nested objects like in [DRF](http://www.django-rest-framework.org/api-guide/serializers/#writable-nested-representations),
468+
it's valid to SerializerMutation and DjangoInputObjectType, only is necessary to specify nested_fields=True on its Meta class definition.
469+
3. Added support to show, only in mutations types to create objects and with debug=True on settings,
470+
inputs autocomplete ordered by required fields first.
466471
4. Fixed others minors bugs.
467472

468473
#### v0.0.1-rc.2:
@@ -483,7 +488,8 @@ subscription{
483488
1. Optimizing imports, fix some minors bugs and working on performance.
484489

485490
#### v0.0.1-beta.5:
486-
1. Repair conflict on converter.py, by the use of get_related_model function with: OneToOneRel, ManyToManyRel and ManyToOneRel.
491+
1. Repair conflict on converter.py, by the use of get_related_model function with: OneToOneRel,
492+
ManyToManyRel and ManyToOneRel.
487493

488494
#### v0.0.1-beta.4:
489495
1. First commit.

0 commit comments

Comments
 (0)