eamigo86/graphene-django-extras

Extras functionalities for Graphene-Django

django
graphene-django
graphene-django-extras
graphql
python

Graphene-Django-Extras

Codecov PyPI - Python Version PyPI PyPI - License PyPI - Downloads Code style: black

This package adds some extra functionalities to graphene-django to facilitate the graphql use without Relay:

  1. Allow pagination and filtering on Queries
  2. Allow defining DjangoRestFramework serializers based on Mutations.
  3. Allow using Directives on Queries and Fragments.

NOTE: Subscription support was moved to graphene-django-subscriptions.

Quick Start

Installation

pip install graphene-django-extras

Basic Usage

from graphene_django_extras import DjangoListObjectType, DjangoSerializerMutation

class UserListType(DjangoListObjectType):
    class Meta:
        model = User

class UserMutation(DjangoSerializerMutation):
    class Meta:
        serializer_class = UserSerializer

Documentation

📚 Full Documentation

The complete documentation includes:

Key Features

🔍 Fields

  • DjangoObjectField
  • DjangoFilterListField
  • DjangoFilterPaginateListField
  • DjangoListObjectField (Recommended)

🧬 Types

  • DjangoListObjectType (Recommended)
  • DjangoInputObjectType
  • DjangoSerializerType (Recommended)

Mutations

  • DjangoSerializerMutation (Recommended)

📄 Pagination

  • LimitOffsetGraphqlPagination
  • PageGraphqlPagination

🎯 Directives

  • String formatting (case, encoding, manipulation)
  • Number formatting (currency, math operations)
  • Date formatting (with python-dateutil)
  • List operations (shuffle, sample)

Development

See our Development Guide for contributing guidelines.

License

MIT License - see LICENSE file for details.

Stars
420
0.24% more than last month
Forks
110
Open Issues
77