diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-15 06:13:56 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-15 06:13:56 +0000 |
| commit | e5e1ceb70e391411156950aab67aa83333dac177 (patch) | |
| tree | b91bedb6f57078873e079f6bc8724d497fbdb3c3 /python-graphene-django-cud.spec | |
| parent | 83f377163ef8312a2adef6a0d019c46ac44b9643 (diff) | |
automatic import of python-graphene-django-cud
Diffstat (limited to 'python-graphene-django-cud.spec')
| -rw-r--r-- | python-graphene-django-cud.spec | 335 |
1 files changed, 335 insertions, 0 deletions
diff --git a/python-graphene-django-cud.spec b/python-graphene-django-cud.spec new file mode 100644 index 0000000..796175d --- /dev/null +++ b/python-graphene-django-cud.spec @@ -0,0 +1,335 @@ +%global _empty_manifest_terminate_build 0 +Name: python-graphene-django-cud +Version: 0.10.0 +Release: 1 +Summary: Create, update and delete mutations for graphene-django +License: MIT License +URL: https://github.com/tOgg1/graphene-django-cud +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/87/1d/906578f55b2319c733fa056c5f406cdb8a7b7e633fb3a55cbed3bbf9ce5e/graphene-django-cud-0.10.0.tar.gz +BuildArch: noarch + +Requires: python3-graphene-django +Requires: python3-graphene-file-upload + +%description +# Graphene Django CUD + + + +[](https://graphene-django-cud.readthedocs.io/en/latest/?badge=latest) + + +This package contains a number of helper mutations making it easy to construct create, update and delete mutations for django models. + +The helper mutations are: + * `DjangoCreateMutation` + * `DjangoPatchMutation` + * `DjangoUpdateMutation` + * `DjangoDeleteMutation` + * `DjangoBatchCreateMutation` + * `DjangoBatchPatchMutation` + * `DjangoBatchUpdateMutation` + * `DjangoBatchDeleteMutation` + * `DjangoFilterUpdateMutation` + * `DjangoFilterDeleteMutation` + +The package handles both regular ids and relay ids automatically. + +## Installation + +`pip install graphene_django_cud` + +## Basic usage + +To use, here illustrated by `DjangoCreateMutation`, simply create a new inherting class. +Suppose we have the following model and Node. + +```python +class User(models.Model): + name = models.CharField(max_length=255) + address = models.TextField() + +class UserNode(DjangoObjectType): + class Meta: + model = User + interfaces = (Node,) +``` + +Then we can create a create mutation with the following schema + +```python +class CreateUserMutation(DjangoCreateMutation): + class Meta: + model = User + + +class Mutation(graphene.ObjectType): + create_user = CreateUserMutation.Field() + + +class Query(graphene.ObjectType): + user = graphene.Field(UserNode, id=graphene.String()) + + def resolve_user(self, info, id): + return User.objects.get(pk=id) + + +schema = Schema(query=Query, mutation=Mutation) +``` + +Note that the `UserNode` has to be registered as a field before the mutation is instantiated. This will be configurable in the future. + +The input to the mutation is a single variable `input` which is automatically created with the models fields. +An example mutation would then be + +```graphql +mutation { + createUser(input: {name: "John Doe", address: "Downing Street 10"}){ + user{ + id + name + address + } + } +} +``` + +## Documentation + +The full documentation can be found at https://graphene-django-cud.readthedocs.io/en/latest/. + + + + +%package -n python3-graphene-django-cud +Summary: Create, update and delete mutations for graphene-django +Provides: python-graphene-django-cud +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-graphene-django-cud +# Graphene Django CUD + + + +[](https://graphene-django-cud.readthedocs.io/en/latest/?badge=latest) + + +This package contains a number of helper mutations making it easy to construct create, update and delete mutations for django models. + +The helper mutations are: + * `DjangoCreateMutation` + * `DjangoPatchMutation` + * `DjangoUpdateMutation` + * `DjangoDeleteMutation` + * `DjangoBatchCreateMutation` + * `DjangoBatchPatchMutation` + * `DjangoBatchUpdateMutation` + * `DjangoBatchDeleteMutation` + * `DjangoFilterUpdateMutation` + * `DjangoFilterDeleteMutation` + +The package handles both regular ids and relay ids automatically. + +## Installation + +`pip install graphene_django_cud` + +## Basic usage + +To use, here illustrated by `DjangoCreateMutation`, simply create a new inherting class. +Suppose we have the following model and Node. + +```python +class User(models.Model): + name = models.CharField(max_length=255) + address = models.TextField() + +class UserNode(DjangoObjectType): + class Meta: + model = User + interfaces = (Node,) +``` + +Then we can create a create mutation with the following schema + +```python +class CreateUserMutation(DjangoCreateMutation): + class Meta: + model = User + + +class Mutation(graphene.ObjectType): + create_user = CreateUserMutation.Field() + + +class Query(graphene.ObjectType): + user = graphene.Field(UserNode, id=graphene.String()) + + def resolve_user(self, info, id): + return User.objects.get(pk=id) + + +schema = Schema(query=Query, mutation=Mutation) +``` + +Note that the `UserNode` has to be registered as a field before the mutation is instantiated. This will be configurable in the future. + +The input to the mutation is a single variable `input` which is automatically created with the models fields. +An example mutation would then be + +```graphql +mutation { + createUser(input: {name: "John Doe", address: "Downing Street 10"}){ + user{ + id + name + address + } + } +} +``` + +## Documentation + +The full documentation can be found at https://graphene-django-cud.readthedocs.io/en/latest/. + + + + +%package help +Summary: Development documents and examples for graphene-django-cud +Provides: python3-graphene-django-cud-doc +%description help +# Graphene Django CUD + + + +[](https://graphene-django-cud.readthedocs.io/en/latest/?badge=latest) + + +This package contains a number of helper mutations making it easy to construct create, update and delete mutations for django models. + +The helper mutations are: + * `DjangoCreateMutation` + * `DjangoPatchMutation` + * `DjangoUpdateMutation` + * `DjangoDeleteMutation` + * `DjangoBatchCreateMutation` + * `DjangoBatchPatchMutation` + * `DjangoBatchUpdateMutation` + * `DjangoBatchDeleteMutation` + * `DjangoFilterUpdateMutation` + * `DjangoFilterDeleteMutation` + +The package handles both regular ids and relay ids automatically. + +## Installation + +`pip install graphene_django_cud` + +## Basic usage + +To use, here illustrated by `DjangoCreateMutation`, simply create a new inherting class. +Suppose we have the following model and Node. + +```python +class User(models.Model): + name = models.CharField(max_length=255) + address = models.TextField() + +class UserNode(DjangoObjectType): + class Meta: + model = User + interfaces = (Node,) +``` + +Then we can create a create mutation with the following schema + +```python +class CreateUserMutation(DjangoCreateMutation): + class Meta: + model = User + + +class Mutation(graphene.ObjectType): + create_user = CreateUserMutation.Field() + + +class Query(graphene.ObjectType): + user = graphene.Field(UserNode, id=graphene.String()) + + def resolve_user(self, info, id): + return User.objects.get(pk=id) + + +schema = Schema(query=Query, mutation=Mutation) +``` + +Note that the `UserNode` has to be registered as a field before the mutation is instantiated. This will be configurable in the future. + +The input to the mutation is a single variable `input` which is automatically created with the models fields. +An example mutation would then be + +```graphql +mutation { + createUser(input: {name: "John Doe", address: "Downing Street 10"}){ + user{ + id + name + address + } + } +} +``` + +## Documentation + +The full documentation can be found at https://graphene-django-cud.readthedocs.io/en/latest/. + + + + +%prep +%autosetup -n graphene-django-cud-0.10.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-graphene-django-cud -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 0.10.0-1 +- Package Spec generated |
