%global _empty_manifest_terminate_build 0 Name: python-drf-json-api-utils Version: 2.0.78 Release: 1 Summary: Utilities to reduce the boiler-plating of django-rest-framework-json-api License: MIT License URL: https://github.com/amitassaraf/drf-json-api-utils Source0: https://mirrors.nju.edu.cn/pypi/web/packages/e7/3e/63c6aec455be666f2d3c514cf82ec12cd1070e60915bb59713256b721e1c/drf-json-api-utils-2.0.78.tar.gz BuildArch: noarch %description By just doing this: ```python user_urls = JsonApiViewBuilder(model=MyUser, resource_name='users', allowed_methods=[json_api_spec_http_methods.HTTP_GET]) \ .fields(['email', 'first_name', 'last_name']) \ .add_filter(name='email', lookups=(lookups.EXACT, lookups.IN)) \ .add_filter(name='order', field='orders__id', lookups=(lookups.EXACT, lookups.IN)) \ .add_relation(field='orders', many=True) \ .get_urls() order_urls = JsonApiViewBuilder(model=Order, resource_name='orders', allowed_methods=[json_api_spec_http_methods.HTTP_GET]) \ .fields(['product', 'date', 'price']) \ .add_relation(field='user', resource_name='users') \ .get_urls() ``` You can get this: `GET /api/users?filter[email]=amit.assaraf@gmail.com` ```json { "links": { "first": "http://localhost:8000/api/users?filter%5Bemail%5D=soit48%40gmail.com&page%5Bnumber%5D=1", "last": "http://localhost:8000/api/users?filter%5Bemail%5D=soit48%40gmail.com&page%5Bnumber%5D=1", "next": null, "prev": null }, "data": [ { "type": "users", "id": "76f7c463-b6a8-4b20-917a-ef98c546eec4", "attributes": { "first-name": "Amit", "last-name": "Assaraf", "email": "amit.assaraf@gmail.com", }, "relationships": { "orders": { "meta": { "count": 2 }, "data": [ { "type": "orders", "id": "6b99e044-462f-472e-9fed-307436b73549" }, { "type": "orders", "id": "304f7f60-7e24-494e-98e2-e9786a3eb588" } ], "links": { "self": "http://localhost:8000/api/users/76f7c463-b6a8-4b20-917a-ef98c546eec4/relationships/orders", "related": "http://localhost:8000/api/orders/76f7c463-b6a8-4b20-917a-ef98c546eec4/" } } } } ], "meta": { "pagination": { "page": 1, "pages": 1, "count": 1 } } } ``` [src]: https://github.com/amitassaraf/drf-json-api-utils [drfjapi]: https://github.com/django-json-api/django-rest-framework-json-api [drf]: https://www.django-rest-framework.org/ %package -n python3-drf-json-api-utils Summary: Utilities to reduce the boiler-plating of django-rest-framework-json-api Provides: python-drf-json-api-utils BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-drf-json-api-utils By just doing this: ```python user_urls = JsonApiViewBuilder(model=MyUser, resource_name='users', allowed_methods=[json_api_spec_http_methods.HTTP_GET]) \ .fields(['email', 'first_name', 'last_name']) \ .add_filter(name='email', lookups=(lookups.EXACT, lookups.IN)) \ .add_filter(name='order', field='orders__id', lookups=(lookups.EXACT, lookups.IN)) \ .add_relation(field='orders', many=True) \ .get_urls() order_urls = JsonApiViewBuilder(model=Order, resource_name='orders', allowed_methods=[json_api_spec_http_methods.HTTP_GET]) \ .fields(['product', 'date', 'price']) \ .add_relation(field='user', resource_name='users') \ .get_urls() ``` You can get this: `GET /api/users?filter[email]=amit.assaraf@gmail.com` ```json { "links": { "first": "http://localhost:8000/api/users?filter%5Bemail%5D=soit48%40gmail.com&page%5Bnumber%5D=1", "last": "http://localhost:8000/api/users?filter%5Bemail%5D=soit48%40gmail.com&page%5Bnumber%5D=1", "next": null, "prev": null }, "data": [ { "type": "users", "id": "76f7c463-b6a8-4b20-917a-ef98c546eec4", "attributes": { "first-name": "Amit", "last-name": "Assaraf", "email": "amit.assaraf@gmail.com", }, "relationships": { "orders": { "meta": { "count": 2 }, "data": [ { "type": "orders", "id": "6b99e044-462f-472e-9fed-307436b73549" }, { "type": "orders", "id": "304f7f60-7e24-494e-98e2-e9786a3eb588" } ], "links": { "self": "http://localhost:8000/api/users/76f7c463-b6a8-4b20-917a-ef98c546eec4/relationships/orders", "related": "http://localhost:8000/api/orders/76f7c463-b6a8-4b20-917a-ef98c546eec4/" } } } } ], "meta": { "pagination": { "page": 1, "pages": 1, "count": 1 } } } ``` [src]: https://github.com/amitassaraf/drf-json-api-utils [drfjapi]: https://github.com/django-json-api/django-rest-framework-json-api [drf]: https://www.django-rest-framework.org/ %package help Summary: Development documents and examples for drf-json-api-utils Provides: python3-drf-json-api-utils-doc %description help By just doing this: ```python user_urls = JsonApiViewBuilder(model=MyUser, resource_name='users', allowed_methods=[json_api_spec_http_methods.HTTP_GET]) \ .fields(['email', 'first_name', 'last_name']) \ .add_filter(name='email', lookups=(lookups.EXACT, lookups.IN)) \ .add_filter(name='order', field='orders__id', lookups=(lookups.EXACT, lookups.IN)) \ .add_relation(field='orders', many=True) \ .get_urls() order_urls = JsonApiViewBuilder(model=Order, resource_name='orders', allowed_methods=[json_api_spec_http_methods.HTTP_GET]) \ .fields(['product', 'date', 'price']) \ .add_relation(field='user', resource_name='users') \ .get_urls() ``` You can get this: `GET /api/users?filter[email]=amit.assaraf@gmail.com` ```json { "links": { "first": "http://localhost:8000/api/users?filter%5Bemail%5D=soit48%40gmail.com&page%5Bnumber%5D=1", "last": "http://localhost:8000/api/users?filter%5Bemail%5D=soit48%40gmail.com&page%5Bnumber%5D=1", "next": null, "prev": null }, "data": [ { "type": "users", "id": "76f7c463-b6a8-4b20-917a-ef98c546eec4", "attributes": { "first-name": "Amit", "last-name": "Assaraf", "email": "amit.assaraf@gmail.com", }, "relationships": { "orders": { "meta": { "count": 2 }, "data": [ { "type": "orders", "id": "6b99e044-462f-472e-9fed-307436b73549" }, { "type": "orders", "id": "304f7f60-7e24-494e-98e2-e9786a3eb588" } ], "links": { "self": "http://localhost:8000/api/users/76f7c463-b6a8-4b20-917a-ef98c546eec4/relationships/orders", "related": "http://localhost:8000/api/orders/76f7c463-b6a8-4b20-917a-ef98c546eec4/" } } } } ], "meta": { "pagination": { "page": 1, "pages": 1, "count": 1 } } } ``` [src]: https://github.com/amitassaraf/drf-json-api-utils [drfjapi]: https://github.com/django-json-api/django-rest-framework-json-api [drf]: https://www.django-rest-framework.org/ %prep %autosetup -n drf-json-api-utils-2.0.78 %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-drf-json-api-utils -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri May 05 2023 Python_Bot - 2.0.78-1 - Package Spec generated