Graphene Dajngo CRUD generator
Project description
Django Graphene CRUD Generator
Installation
pip install graphi-crud
Usage
import graphene
from graphi_crud.queries import Queries
from graphi_crud.create_mutation import CreateMutation
from graphi_crud.update_mutation import UpdateMutation
from graphi_crud.delete_mutation import DeleteMutation
Queries.generate_queries(["accounts"])
CreateMutation.generate_mutations(['accounts'])
UpdateMutation.generate_mutations(['accounts'])
DeleteMutation.generate_mutations(['accounts'])
class Query(Queries):
pass
class Mutation(CreateMutation, UpdateMutation, DeleteMutation):
pass
schema = graphene.Schema(query=Query, mutation=Mutation)
register your schema
in settings and your good to go
writing Queries
{
user(where: {email: {icontains: "user"}}, offset: 10, limit: 10){
id
email
}
}
create mutation example
mutation{
createUser(inputs: {email: "user@gmail.com", username: "newuser"}){
data{
id
email
}
}
}
update mutation example
mutation{
updateUser(inputs: {lastLogin: "2023-12-12"}, where: {email: {icontains: "someuser"}}){
affectedRows
data {
id
username
}
}
}
delete mutation examples
mutation{
deleteUser(where: {email: {icontains: "someuser"}}){
affectedRows
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
graphi_crud-1.0.2.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for graphi_crud-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dc3c88e884c716b36a23be586ea7a6df6aa2bc621f7564de4ef0be233559b59 |
|
MD5 | a79ce4e6d0f2d340327f1ed2f4cacbcf |
|
BLAKE2b-256 | d45389db45c321e89d30301ef1fc8c1e4fee2d57582db56ec7611999225146d7 |