https://github.com/jottenlips/django-polls-graphene
๐ Django Polls App with Graphene, Relay, and Dataloaders
https://github.com/jottenlips/django-polls-graphene
dataloaders demo django django-graphql example graphene graphene-django graphene-django-polls graphql graphql-server nplus1 polls python relay
Last synced: 2 months ago
JSON representation
๐ Django Polls App with Graphene, Relay, and Dataloaders
- Host: GitHub
- URL: https://github.com/jottenlips/django-polls-graphene
- Owner: jottenlips
- Created: 2020-11-25T04:33:03.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2020-12-03T00:33:47.000Z (almost 5 years ago)
- Last Synced: 2025-07-28T23:57:17.905Z (3 months ago)
- Topics: dataloaders, demo, django, django-graphql, example, graphene, graphene-django, graphene-django-polls, graphql, graphql-server, nplus1, polls, python, relay
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# Django Polls GraphQL ๐
This is a Django GraphQL App based on the Django Polls tutorial.
I made this to experiment ๐งช with dataloaders and the relay pattern.## Run locally
Install Pipenv
https://pypi.org/project/pipenv/
`pipenv install`
`cd django_graphene_data_loaders_demo`
`pipenv run python manage.py migrate`
`pipenv run python manage.py createsuperuser`
Go to the Django admin, login, and add your questions and choices. `localhost:8000/admin`
`pipenv run python manage.py runserver`
## Query
Resolve question uses a dataloader for efficient querying.
```
{
choices {
edges {
node {
id
choiceText
votes
question {
id
questionText
}
}
}
}
# Debug your SQL
_debug {
sql {
rawSql
}
}
}```
## Mutation
```
mutation Vote($question: ID, $choice: ID) {
vote(questionGlobalId: $question, choiceGlobalId: $choice){
question {
id
choiceSet {
edges {
node {
id
votes
}
}
}
}
}
}
```TODO:
[] Frontend CRNA / Apollo
[] Add auth and user types