Skip to content

An OpenCrud implementation with Graphene Django, following Prisma convention

License

Notifications You must be signed in to change notification settings

inspired-solutions/graphene-django-opencrud

Repository files navigation

OpenCrud Graphene Django implementation

Usage

import graphene
from graphene_django.types import DjangoObjectType

from django.contrib.auth import models as auth_models
from graphene import Node

from opencrud.connection import WithOpenCrudConnection
from opencrud.list import OpenCrudDjangoFilterListField
from opencrud.filter import OpenCrudDjangoFilterConnectionField
from opencrud.field import OpenCrudDjangoField


class User(DjangoObjectType):
    @WithOpenCrudConnection(auth_models.User)
    class Meta:
        filter_fields = ('id', 'email', )
        interfaces = (Node, )


class Query(graphene.ObjectType):
    user = OpenCrudDjangoField(User)
    users = OpenCrudDjangoFilterListField(User)
    users_connection = OpenCrudDjangoFilterConnectionField(User)

Contributing

After cloning this repo, ensure dependencies are installed by running:

pip install -e ".[test]"

After developing, the full test suite can be evaluated by running:

py.test opencrud --cov=opencrud # Use -v -s for verbose mode

About

An OpenCrud implementation with Graphene Django, following Prisma convention

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages