Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove graphene-django dependency (#9170)

Rafał Pitońdb318925f991
diff --git a/.isort.cfg b/.isort.cfg
index 6f5dbb7464..f774c71231 100644
--- a/.isort.cfg
+++ b/.isort.cfg
@@ -1,2 +1,2 @@
[settings]
-known_third_party = Adyen,PIL,authorizenet,babel,boto3,botocore,braintree,celery,cryptography,dateutil,dj_database_url,dj_email_url,django,django_cache_url,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,google,google_measurement_protocol,graphene,graphene_django,graphene_federation,graphql,graphql_relay,html2text,html_to_draftjs,i18naddress,jaeger_client,jwt,kombu,lxml,markdown,measurement,micawber,mptt,oauthlib,openpyxl,opentracing,petl,phonenumber_field,phonenumbers,pkg_resources,prices,promise,pybars,pytest,pythonjsonlogger,pytimeparse,pytz,razorpay,requests,sendgrid,sentry_sdk,storages,stripe,urllib3,uvicorn,versatileimagefield,weasyprint
+known_third_party = Adyen,PIL,authorizenet,babel,boto3,botocore,braintree,celery,cryptography,dateutil,dj_database_url,dj_email_url,django,django_cache_url,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,google,google_measurement_protocol,graphene,graphene_federation,graphql,graphql_relay,html2text,html_to_draftjs,i18naddress,jaeger_client,jwt,kombu,lxml,markdown,measurement,micawber,mptt,oauthlib,openpyxl,opentracing,petl,phonenumber_field,phonenumbers,pkg_resources,prices,promise,pybars,pytest,pythonjsonlogger,pytimeparse,pytz,razorpay,requests,sendgrid,sentry_sdk,storages,stripe,urllib3,uvicorn,versatileimagefield,weasyprint
diff --git a/CHANGELOG.md b/CHANGELOG.md
index feb9012201..0940f985cc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Do no allow using `id` for updating checkout and order metadata - #8906 by @IKarbowiak
- Use `token` instead
+- Remove `graphene-django` dependency - #9170 by @rafalp
## Other
diff --git a/poetry.lock b/poetry.lock
index 6b27bd121b..fb9c5de743 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1082,7 +1082,7 @@ test = ["pytest", "pytest-benchmark", "pytest-cov", "pytest-mock", "fastdiff (==
name = "graphene-django"
version = "2.13.0"
description = "Graphene Django integration"
-category = "main"
+category = "dev"
optional = false
python-versions = "*"
@@ -2323,7 +2323,7 @@ tornado = ["tornado (>=5)"]
name = "singledispatch"
version = "3.7.0"
description = "Backport functools.singledispatch from Python 3.4 to Python 2.6-3.3."
-category = "main"
+category = "dev"
optional = false
python-versions = ">=2.6"
@@ -2582,7 +2582,7 @@ typing-extensions = ">=3.7.4"
name = "unidecode"
version = "1.3.2"
description = "ASCII transliterations of Unicode text"
-category = "main"
+category = "dev"
optional = false
python-versions = ">=3.5"
@@ -2771,7 +2771,7 @@ python-versions = "*"
[metadata]
lock-version = "1.1"
python-versions = "~3.9"
-content-hash = "014e9770ae62aa524663f5c36e0890d7c031588d10aeb4b19d38e1f007a70323"
+content-hash = "ec299ffb4d5d0d43adbc157c3311d9b6928d942fa9c73b086ece66a466e8f6f5"
[metadata.files]
adyen = [
@@ -2849,6 +2849,9 @@ brotli = [
{file = "Brotli-1.0.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ee83d3e3a024a9618e5be64648d6d11c37047ac48adff25f12fa4226cf23d1c"},
{file = "Brotli-1.0.9-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:19598ecddd8a212aedb1ffa15763dd52a388518c4550e615aed88dc3753c0f0c"},
{file = "Brotli-1.0.9-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:44bb8ff420c1d19d91d79d8c3574b8954288bdff0273bf788954064d260d7ab0"},
+ {file = "Brotli-1.0.9-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e23281b9a08ec338469268f98f194658abfb13658ee98e2b7f85ee9dd06caa91"},
+ {file = "Brotli-1.0.9-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:3496fc835370da351d37cada4cf744039616a6db7d13c430035e901443a34daa"},
+ {file = "Brotli-1.0.9-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:b83bb06a0192cccf1eb8d0a28672a1b79c74c3a8a5f2619625aeb6f28b3a82bb"},
{file = "Brotli-1.0.9-cp310-cp310-win32.whl", hash = "sha256:26d168aac4aaec9a4394221240e8a5436b5634adc3cd1cdf637f6645cecbf181"},
{file = "Brotli-1.0.9-cp310-cp310-win_amd64.whl", hash = "sha256:622a231b08899c864eb87e85f81c75e7b9ce05b001e59bbfbf43d4a71f5f32b2"},
{file = "Brotli-1.0.9-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:c83aa123d56f2e060644427a882a36b3c12db93727ad7a7b9efd7d7f3e9cc2c4"},
@@ -2860,12 +2863,18 @@ brotli = [
{file = "Brotli-1.0.9-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:40d15c79f42e0a2c72892bf407979febd9cf91f36f495ffb333d1d04cebb34e4"},
{file = "Brotli-1.0.9-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:93130612b837103e15ac3f9cbacb4613f9e348b58b3aad53721d92e57f96d46a"},
{file = "Brotli-1.0.9-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:87fdccbb6bb589095f413b1e05734ba492c962b4a45a13ff3408fa44ffe6479b"},
+ {file = "Brotli-1.0.9-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:6d847b14f7ea89f6ad3c9e3901d1bc4835f6b390a9c71df999b0162d9bb1e20f"},
+ {file = "Brotli-1.0.9-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:495ba7e49c2db22b046a53b469bbecea802efce200dffb69b93dd47397edc9b6"},
+ {file = "Brotli-1.0.9-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:4688c1e42968ba52e57d8670ad2306fe92e0169c6f3af0089be75bbac0c64a3b"},
{file = "Brotli-1.0.9-cp36-cp36m-win32.whl", hash = "sha256:61a7ee1f13ab913897dac7da44a73c6d44d48a4adff42a5701e3239791c96e14"},
{file = "Brotli-1.0.9-cp36-cp36m-win_amd64.whl", hash = "sha256:1c48472a6ba3b113452355b9af0a60da5c2ae60477f8feda8346f8fd48e3e87c"},
{file = "Brotli-1.0.9-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:3b78a24b5fd13c03ee2b7b86290ed20efdc95da75a3557cc06811764d5ad1126"},
{file = "Brotli-1.0.9-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:9d12cf2851759b8de8ca5fde36a59c08210a97ffca0eb94c532ce7b17c6a3d1d"},
{file = "Brotli-1.0.9-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:6c772d6c0a79ac0f414a9f8947cc407e119b8598de7621f39cacadae3cf57d12"},
{file = "Brotli-1.0.9-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:29d1d350178e5225397e28ea1b7aca3648fcbab546d20e7475805437bfb0a130"},
+ {file = "Brotli-1.0.9-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:7bbff90b63328013e1e8cb50650ae0b9bac54ffb4be6104378490193cd60f85a"},
+ {file = "Brotli-1.0.9-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:ec1947eabbaf8e0531e8e899fc1d9876c179fc518989461f5d24e2223395a9e3"},
+ {file = "Brotli-1.0.9-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:12effe280b8ebfd389022aa65114e30407540ccb89b177d3fbc9a4f177c4bd5d"},
{file = "Brotli-1.0.9-cp37-cp37m-win32.whl", hash = "sha256:f909bbbc433048b499cb9db9e713b5d8d949e8c109a2a548502fb9aa8630f0b1"},
{file = "Brotli-1.0.9-cp37-cp37m-win_amd64.whl", hash = "sha256:97f715cf371b16ac88b8c19da00029804e20e25f30d80203417255d239f228b5"},
{file = "Brotli-1.0.9-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e16eb9541f3dd1a3e92b89005e37b1257b157b7256df0e36bd7b33b50be73bcb"},
@@ -2873,6 +2882,9 @@ brotli = [
{file = "Brotli-1.0.9-cp38-cp38-manylinux1_i686.whl", hash = "sha256:b663f1e02de5d0573610756398e44c130add0eb9a3fc912a09665332942a2efb"},
{file = "Brotli-1.0.9-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:5b6ef7d9f9c38292df3690fe3e302b5b530999fa90014853dcd0d6902fb59f26"},
{file = "Brotli-1.0.9-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8a674ac10e0a87b683f4fa2b6fa41090edfd686a6524bd8dedbd6138b309175c"},
+ {file = "Brotli-1.0.9-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:e2d9e1cbc1b25e22000328702b014227737756f4b5bf5c485ac1d8091ada078b"},
+ {file = "Brotli-1.0.9-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:b336c5e9cf03c7be40c47b5fd694c43c9f1358a80ba384a21969e0b4e66a9b17"},
+ {file = "Brotli-1.0.9-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:85f7912459c67eaab2fb854ed2bc1cc25772b300545fe7ed2dc03954da638649"},
{file = "Brotli-1.0.9-cp38-cp38-win32.whl", hash = "sha256:35a3edbe18e876e596553c4007a087f8bcfd538f19bc116917b3c7522fca0429"},
{file = "Brotli-1.0.9-cp38-cp38-win_amd64.whl", hash = "sha256:269a5743a393c65db46a7bb982644c67ecba4b8d91b392403ad8a861ba6f495f"},
{file = "Brotli-1.0.9-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:2aad0e0baa04517741c9bb5b07586c642302e5fb3e75319cb62087bd0995ab19"},
@@ -2880,6 +2892,9 @@ brotli = [
{file = "Brotli-1.0.9-cp39-cp39-manylinux1_i686.whl", hash = "sha256:16d528a45c2e1909c2798f27f7bf0a3feec1dc9e50948e738b961618e38b6a7b"},
{file = "Brotli-1.0.9-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:56d027eace784738457437df7331965473f2c0da2c70e1a1f6fdbae5402e0389"},
{file = "Brotli-1.0.9-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9bf919756d25e4114ace16a8ce91eb340eb57a08e2c6950c3cebcbe3dff2a5e7"},
+ {file = "Brotli-1.0.9-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:e4c4e92c14a57c9bd4cb4be678c25369bf7a092d55fd0866f759e425b9660806"},
+ {file = "Brotli-1.0.9-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:e48f4234f2469ed012a98f4b7874e7f7e173c167bed4934912a29e03167cf6b1"},
+ {file = "Brotli-1.0.9-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9ed4c92a0665002ff8ea852353aeb60d9141eb04109e88928026d3c8a9e5433c"},
{file = "Brotli-1.0.9-cp39-cp39-win32.whl", hash = "sha256:cfc391f4429ee0a9370aa93d812a52e1fee0f37a81861f4fdd1f4fb28e8547c3"},
{file = "Brotli-1.0.9-cp39-cp39-win_amd64.whl", hash = "sha256:854c33dad5ba0fbd6ab69185fec8dab89e13cda6b7d191ba111987df74f38761"},
{file = "Brotli-1.0.9-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:9749a124280a0ada4187a6cfd1ffd35c350fb3af79c706589d98e088c5044267"},
@@ -3388,6 +3403,7 @@ grpcio-status = [
{file = "grpcio_status-1.43.0-py3-none-any.whl", hash = "sha256:9036b24f5769adafdc3e91d9434c20e9ede0b30f50cc6bff105c0f414bb9e0e0"},
]
gunicorn = [
+ {file = "gunicorn-20.1.0-py3-none-any.whl", hash = "sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e"},
{file = "gunicorn-20.1.0.tar.gz", hash = "sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8"},
]
h11 = [
@@ -3598,12 +3614,28 @@ markdown = [
{file = "Markdown-3.3.6.tar.gz", hash = "sha256:76df8ae32294ec39dcf89340382882dfa12975f87f45c3ed1ecdb1e8cefc7006"},
]
markupsafe = [
+ {file = "MarkupSafe-2.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d8446c54dc28c01e5a2dbac5a25f071f6653e6e40f3a8818e8b45d790fe6ef53"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:36bc903cbb393720fad60fc28c10de6acf10dc6cc883f3e24ee4012371399a38"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d7d807855b419fc2ed3e631034685db6079889a1f01d5d9dac950f764da3dad"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:add36cb2dbb8b736611303cd3bfcee00afd96471b09cda130da3581cbdc56a6d"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:168cd0a3642de83558a5153c8bd34f175a9a6e7f6dc6384b9655d2697312a646"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:4dc8f9fb58f7364b63fd9f85013b780ef83c11857ae79f2feda41e270468dd9b"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:20dca64a3ef2d6e4d5d615a3fd418ad3bde77a47ec8a23d984a12b5b4c74491a"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:cdfba22ea2f0029c9261a4bd07e830a8da012291fbe44dc794e488b6c9bb353a"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-win32.whl", hash = "sha256:99df47edb6bda1249d3e80fdabb1dab8c08ef3975f69aed437cb69d0a5de1e28"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:e0f138900af21926a02425cf736db95be9f4af72ba1bb21453432a07f6082134"},
{file = "MarkupSafe-2.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51"},
{file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff"},
{file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b"},
{file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94"},
{file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872"},
{file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf5d821ffabf0ef3533c39c518f3357b171a1651c1ff6827325e4489b0e46c3c"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:0d4b31cc67ab36e3392bbf3862cfbadac3db12bdd8b02a2731f509ed5b829724"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:baa1a4e8f868845af802979fcdbf0bb11f94f1cb7ced4c4b8a351bb60d108145"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:deb993cacb280823246a026e3b2d81c493c53de6acfd5e6bfe31ab3402bb37dd"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:63f3268ba69ace99cab4e3e3b5840b03340efed0948ab8f78d2fd87ee5442a4f"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:8d206346619592c6200148b01a2142798c989edcb9c896f9ac9722a99d4e77e6"},
{file = "MarkupSafe-2.0.1-cp36-cp36m-win32.whl", hash = "sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d"},
{file = "MarkupSafe-2.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9"},
{file = "MarkupSafe-2.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567"},
@@ -3612,14 +3644,27 @@ markupsafe = [
{file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f"},
{file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2"},
{file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e9936f0b261d4df76ad22f8fee3ae83b60d7c3e871292cd42f40b81b70afae85"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:2a7d351cbd8cfeb19ca00de495e224dea7e7d919659c2841bbb7f420ad03e2d6"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:60bf42e36abfaf9aff1f50f52644b336d4f0a3fd6d8a60ca0d054ac9f713a864"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:d6c7ebd4e944c85e2c3421e612a7057a2f48d478d79e61800d81468a8d842207"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:f0567c4dc99f264f49fe27da5f735f414c4e7e7dd850cfd8e69f0862d7c74ea9"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:89c687013cb1cd489a0f0ac24febe8c7a666e6e221b783e53ac50ebf68e45d86"},
{file = "MarkupSafe-2.0.1-cp37-cp37m-win32.whl", hash = "sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415"},
{file = "MarkupSafe-2.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:5bb28c636d87e840583ee3adeb78172efc47c8b26127267f54a9c0ec251d41a9"},
{file = "MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066"},
{file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35"},
{file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b"},
{file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298"},
{file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75"},
{file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6fcf051089389abe060c9cd7caa212c707e58153afa2c649f00346ce6d260f1b"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:5855f8438a7d1d458206a2466bf82b0f104a3724bf96a1c781ab731e4201731a"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:3dd007d54ee88b46be476e293f48c85048603f5f516008bee124ddd891398ed6"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:aca6377c0cb8a8253e493c6b451565ac77e98c2951c45f913e0b52facdcff83f"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:04635854b943835a6ea959e948d19dcd311762c5c0c6e1f0e16ee57022669194"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6300b8454aa6930a24b9618fbb54b5a68135092bc666f7b06901f897fa5c2fee"},
{file = "MarkupSafe-2.0.1-cp38-cp38-win32.whl", hash = "sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64"},
{file = "MarkupSafe-2.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833"},
{file = "MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26"},
@@ -3629,6 +3674,12 @@ markupsafe = [
{file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135"},
{file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902"},
{file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c47adbc92fc1bb2b3274c4b3a43ae0e4573d9fbff4f54cd484555edbf030baf1"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:37205cac2a79194e3750b0af2a5720d95f786a55ce7df90c3af697bfa100eaac"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:1f2ade76b9903f39aa442b4aadd2177decb66525062db244b35d71d0ee8599b6"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:4296f2b1ce8c86a6aea78613c34bb1a672ea0e3de9c6ba08a960efe0b0a09047"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9f02365d4e99430a12647f09b6cc8bab61a6564363f313126f775eb4f6ef798e"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5b6d930f030f8ed98e3e6c98ffa0652bdb82601e7a016ec2ab5d7ff23baa78d1"},
{file = "MarkupSafe-2.0.1-cp39-cp39-win32.whl", hash = "sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74"},
{file = "MarkupSafe-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8"},
{file = "MarkupSafe-2.0.1.tar.gz", hash = "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a"},
@@ -3771,6 +3822,9 @@ phonenumberslite = [
{file = "phonenumberslite-8.12.43.tar.gz", hash = "sha256:e64d3d7d9f23bc6e623e4bc29810cd686548553141bf42f5f7b2e4a98a982b6b"},
]
pillow = [
+ {file = "Pillow-9.0.1-1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a5d24e1d674dd9d72c66ad3ea9131322819ff86250b30dc5821cbafcfa0b96b4"},
+ {file = "Pillow-9.0.1-1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:2632d0f846b7c7600edf53c48f8f9f1e13e62f66a6dbc15191029d950bfed976"},
+ {file = "Pillow-9.0.1-1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b9618823bd237c0d2575283f2939655f54d51b4527ec3972907a927acbcc5bfc"},
{file = "Pillow-9.0.1-cp310-cp310-macosx_10_10_universal2.whl", hash = "sha256:9bfdb82cdfeccec50aad441afc332faf8606dfa5e8efd18a6692b5d6e79f00fd"},
{file = "Pillow-9.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5100b45a4638e3c00e4d2320d3193bdabb2d75e79793af7c3eb139e4f569f16f"},
{file = "Pillow-9.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:528a2a692c65dd5cafc130de286030af251d2ee0483a5bf50c9348aefe834e8a"},
diff --git a/pyproject.toml b/pyproject.toml
index a02d76b1a6..58c3c0cf26 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -32,7 +32,6 @@ documentation = "https://docs.saleor.io/"
google-cloud-storage = "^2.0.0"
google-i18n-address = "^2.3.5"
google-measurement-protocol = "^1.0"
- graphene-django = "2.13.0"
graphene-federation = "^0.1.0"
html-to-draftjs = "^1.0.1"
markdown = "^3.1.1"
diff --git a/requirements.txt b/requirements.txt
index 0aa58aa1b3..fcc7e44801 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -59,7 +59,6 @@ google-i18n-address==2.5.0
google-measurement-protocol==1.1.0
google-resumable-media==2.2.1; python_version >= "3.7"
googleapis-common-protos==1.54.0; python_version >= "3.7"
-graphene-django==2.13.0
graphene-federation==0.1.0
graphene==2.1.9
graphql-core==2.3.2
@@ -128,7 +127,6 @@ rx==1.6.1
s3transfer==0.5.1; python_version >= "3.6"
sendgrid==6.9.6; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
sentry-sdk==1.5.5
-singledispatch==3.7.0; python_version >= "2.6"
six==1.16.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7"
soupsieve==2.3.1; python_version >= "3.6"
sqlparse==0.4.2; python_version >= "3.6"
@@ -142,7 +140,6 @@ tinycss2==1.1.1; python_version >= "3.6"
tornado==6.1; python_version >= "3.7"
typing-extensions==4.1.1; python_version >= "3.6"
typing-inspect==0.7.1; python_version >= "3.6"
-unidecode==1.3.2; python_version >= "3.5"
urllib3==1.26.8; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.6"
uvicorn==0.13.4
uvloop==0.16.0; sys_platform != "win32" and sys_platform != "cygwin" and platform_python_implementation != "PyPy" and python_version >= "3.7"
diff --git a/requirements_dev.txt b/requirements_dev.txt
index 434cf7c2a4..c5b27e7f6b 100644
--- a/requirements_dev.txt
+++ b/requirements_dev.txt
@@ -79,7 +79,7 @@ google-i18n-address==2.5.0
google-measurement-protocol==1.1.0
google-resumable-media==2.2.1; python_version >= "3.7"
googleapis-common-protos==1.54.0; python_version >= "3.7"
-graphene-django==2.13.0
+graphene-django==2.13.0; python_version >= "3.6" and python_version < "4.0"
graphene-federation==0.1.0
graphene==2.1.9; python_version >= "3.6" and python_version < "4.0"
graphql-core==2.3.2; python_version >= "3.6" and python_version < "4.0"
@@ -183,7 +183,7 @@ s3transfer==0.5.1; python_version >= "3.6"
sendgrid==6.9.6; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
sentry-sdk==1.5.5
singledispatch==3.7.0; python_version >= "3.6" and python_version < "4.0"
-six==1.16.0; python_full_version >= "3.6.1" and python_version < "3.10" and python_version >= "3.7" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.5") and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0")
+six==1.16.0; python_full_version >= "3.6.1" and python_version < "3.10" and python_version >= "3.7" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.5") and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0") and (python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.3.0")
smmap==5.0.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version < "3.10" and python_version >= "3.7"
snowballstemmer==2.2.0; python_version >= "3.6"
soupsieve==2.3.1; python_version >= "3.6"
diff --git a/saleor/graphql/account/filters.py b/saleor/graphql/account/filters.py
index 603007ebb1..2d4c16b882 100644
--- a/saleor/graphql/account/filters.py
+++ b/saleor/graphql/account/filters.py
@@ -1,10 +1,14 @@
import django_filters
from django.db.models import Count
-from graphene_django.filter import GlobalIDMultipleChoiceFilter
from ...account.models import User
from ...account.search import search_users
-from ..core.filters import EnumFilter, MetadataFilterBase, ObjectTypeFilter
+from ..core.filters import (
+ EnumFilter,
+ GlobalIDMultipleChoiceFilter,
+ MetadataFilterBase,
+ ObjectTypeFilter,
+)
from ..core.types.common import DateRangeInput, IntRangeInput
from ..utils.filters import filter_by_id, filter_range_field
from . import types as account_types
diff --git a/saleor/graphql/attribute/filters.py b/saleor/graphql/attribute/filters.py
index 38d22276c8..4ece4cd3ed 100644
--- a/saleor/graphql/attribute/filters.py
+++ b/saleor/graphql/attribute/filters.py
@@ -1,6 +1,5 @@
import django_filters
from django.db.models import Q
-from graphene_django.filter import GlobalIDFilter, GlobalIDMultipleChoiceFilter
from ...attribute.models import Attribute, AttributeValue
from ...core.permissions import has_one_of_permissions
@@ -8,7 +7,12 @@ from ...product import models
from ...product.models import ALL_PRODUCTS_PERMISSIONS
from ..attribute.enums import AttributeTypeEnum
from ..channel.filters import get_channel_slug_from_filter_data
-from ..core.filters import EnumFilter, MetadataFilterBase
+from ..core.filters import (
+ EnumFilter,
+ GlobalIDFilter,
+ GlobalIDMultipleChoiceFilter,
+ MetadataFilterBase,
+)
from ..core.types import ChannelFilterInputObjectType, FilterInputObjectType
from ..core.utils import from_global_id_or_error
from ..utils import get_user_or_app_from_context
diff --git a/saleor/graphql/checkout/filters.py b/saleor/graphql/checkout/filters.py
index 720e05bfbf..cd38a0fedc 100644
--- a/saleor/graphql/checkout/filters.py
+++ b/saleor/graphql/checkout/filters.py
@@ -2,13 +2,16 @@ from uuid import UUID
import django_filters
from django.db.models import Exists, OuterRef, Q
-from graphene_django.filter import GlobalIDMultipleChoiceFilter
from ...account.models import User
from ...checkout.models import Checkout
from ...payment.models import Payment
from ..channel.types import Channel
-from ..core.filters import MetadataFilterBase, ObjectTypeFilter
+from ..core.filters import (
+ GlobalIDMultipleChoiceFilter,
+ MetadataFilterBase,
+ ObjectTypeFilter,
+)
from ..core.types import FilterInputObjectType
from ..core.types.common import DateRangeInput
from ..core.utils import from_global_id_or_error
diff --git a/saleor/graphql/core/filters.py b/saleor/graphql/core/filters.py
index beaa1a6ce9..4fa6d49b11 100644
--- a/saleor/graphql/core/filters.py
+++ b/saleor/graphql/core/filters.py
@@ -1,7 +1,9 @@
import django_filters
import graphene
from django.core.exceptions import ValidationError
-from django_filters.fields import MultipleChoiceField
+from django.forms import CharField, Field, MultipleChoiceField
+from django_filters import Filter, MultipleChoiceFilter
+from graphql_relay import from_global_id
from ..utils.filters import filter_range_field
from .enums import JobStatusEnum
@@ -100,3 +102,58 @@ class MetadataFilterBase(django_filters.FilterSet):
class Meta:
abstract = True
+
+
+class GlobalIDFormField(Field):
+ default_error_messages = {"invalid": "Invalid ID specified."}
+
+ def clean(self, value):
+ if not value and not self.required:
+ return None
+
+ try:
+ _type, _id = from_global_id(value)
+ except (TypeError, ValueError):
+ raise ValidationError(self.error_messages["invalid"])
+
+ try:
+ CharField().clean(_id)
+ CharField().clean(_type)
+ except ValidationError:
+ raise ValidationError(self.error_messages["invalid"])
+
+ return value
+
+
+class GlobalIDFilter(Filter):
+ field_class = GlobalIDFormField
+
+ def filter(self, qs, value):
+ """Convert the filter value to a primary key before filtering."""
+ _id = None
+ if value is not None:
+ _, _id = from_global_id(value)
+ return super(GlobalIDFilter, self).filter(qs, _id)
+
+
+class GlobalIDMultipleChoiceField(MultipleChoiceField):
+ default_error_messages = {
+ "invalid_choice": "One of the specified IDs was invalid (%(value)s).",
+ "invalid_list": "Enter a list of values.",
+ }
+
+ def to_python(self, value):
+ return super().to_python(value)
+
+ def valid_value(self, value):
+ # Clean will raise a validation error if there is a problem
+ GlobalIDFormField().clean(value)
+ return True
+
+
+class GlobalIDMultipleChoiceFilter(MultipleChoiceFilter):
+ field_class = GlobalIDMultipleChoiceField
+
+ def filter(self, qs, value):
+ gids = [from_global_id(v)[1] for v in value]
+ return super(GlobalIDMultipleChoiceFilter, self).filter(qs, gids)
diff --git a/saleor/graphql/core/types/converter.py b/saleor/graphql/core/types/converter.py
index 4a361ae6a9..68f50e9632 100644
--- a/saleor/graphql/core/types/converter.py
+++ b/saleor/graphql/core/types/converter.py
@@ -1,33 +1,48 @@
+"""Form fields converter subset from graphene_django for use in Saleor."""
+
+from functools import singledispatch
+
import graphene
-from django_measurement.models import MeasurementField
-from django_prices.models import MoneyField, TaxedMoneyField
-from graphene_django.converter import convert_django_field
-from graphene_django.forms.converter import convert_form_field
+from django import forms
+from django.core.exceptions import ImproperlyConfigured
+
+from ..filters import (
+ EnumFilter,
+ GlobalIDFormField,
+ GlobalIDMultipleChoiceField,
+ ListObjectTypeFilter,
+ ObjectTypeFilter,
+)
+
-from ....account.models import PossiblePhoneNumberField
-from ..filters import EnumFilter, ListObjectTypeFilter, ObjectTypeFilter
-from .common import Weight
-from .money import Money, TaxedMoney
+def get_form_field_description(field):
+ return str(field.help_text) if field.help_text else None
-@convert_django_field.register(PossiblePhoneNumberField)
-def convert_phone_number_field_to_string(*_args):
- return graphene.String()
+@singledispatch
+def convert_form_field(field):
+ raise ImproperlyConfigured(
+ "Don't know how to convert the Django form field %s (%s) "
+ "to Graphene type" % (field, field.__class__)
+ )
-@convert_django_field.register(TaxedMoneyField)
-def convert_field_taxed_money(*_args):
- return graphene.Field(TaxedMoney)
+@convert_form_field.register(forms.CharField)
+def convert_form_field_to_string(field):
+ return graphene.String(
+ description=get_form_field_description(field), required=field.required
+ )
-@convert_django_field.register(MoneyField)
-def convert_field_money(*_args):
- return graphene.Field(Money)
+@convert_form_field.register(forms.NullBooleanField)
+def convert_form_field_to_nullboolean(field):
+ return graphene.Boolean(description=get_form_field_description(field))
-@convert_django_field.register(MeasurementField)
-def convert_field_measurements(*_args):
- return graphene.Field(Weight)
+@convert_form_field.register(forms.DecimalField)
+@convert_form_field.register(forms.FloatField)
+def convert_form_field_to_float(field):
+ return graphene.Float(description=field.help_text, required=field.required)
@convert_form_field.register(ObjectTypeFilter)
@@ -36,6 +51,16 @@ def convert_convert_enum(field):
return field.input_class()
+@convert_form_field.register(GlobalIDFormField)
+def convert_form_field_to_id(field):
+ return graphene.ID(required=field.required)
+
+
@convert_form_field.register(ListObjectTypeFilter)
def convert_list_object_type(field):
return graphene.List(field.input_class)
+
+
+@convert_form_field.register(GlobalIDMultipleChoiceField)
+def convert_form_field_to_list(field):
+ return graphene.List(graphene.ID, required=field.required)
diff --git a/saleor/graphql/core/types/filter_input.py b/saleor/graphql/core/types/filter_input.py
index 868420300f..785441e915 100644
--- a/saleor/graphql/core/types/filter_input.py
+++ b/saleor/graphql/core/types/filter_input.py
@@ -1,11 +1,38 @@
+import itertools
+
+from django.db import models
+from django_filters.filterset import FILTER_FOR_DBFIELD_DEFAULTS, BaseFilterSet
from graphene import Argument, InputField, InputObjectType, String
from graphene.types.inputobjecttype import InputObjectTypeOptions
from graphene.types.utils import yank_fields_from_attrs
-from graphene_django.filter.utils import get_filterset_class
from ..descriptions import DEPRECATED_IN_3X_INPUT
+from ..filters import GlobalIDFilter, GlobalIDMultipleChoiceFilter
from .converter import convert_form_field
+GLOBAL_ID_FILTERS = {
+ models.AutoField: {"filter_class": GlobalIDFilter},
+ models.OneToOneField: {"filter_class": GlobalIDFilter},
+ models.ForeignKey: {"filter_class": GlobalIDFilter},
+ models.ManyToManyField: {"filter_class": GlobalIDMultipleChoiceFilter},
+ models.ManyToOneRel: {"filter_class": GlobalIDMultipleChoiceFilter},
+ models.ManyToManyRel: {"filter_class": GlobalIDMultipleChoiceFilter},
+}
+
+
+class GraphQLFilterSetMixin(BaseFilterSet):
+ FILTER_DEFAULTS = dict(
+ itertools.chain(FILTER_FOR_DBFIELD_DEFAULTS.items(), GLOBAL_ID_FILTERS.items())
+ )
+
+
+def get_filterset_class(filterset_class=None):
+ return type(
+ "GraphQL{}".format(filterset_class.__name__),
+ (filterset_class, GraphQLFilterSetMixin),
+ {},
+ )
+
class FilterInputObjectType(InputObjectType):
"""Class for storing and serving django-filtres as graphQL input.
@@ -43,13 +70,9 @@ class FilterInputObjectType(InputObjectType):
These arguments will be available to filter against in the GraphQL.
"""
if not cls.custom_filterset_class:
- assert cls.model and cls.fields, (
- "Provide filterset class or model and fields requested to "
- "create default filterset"
- )
+ raise ValueError("Provide filterset class")
- meta = dict(model=cls.model, fields=cls.fields)
- cls.filterset_class = get_filterset_class(cls.custom_filterset_class, **meta)
+ cls.filterset_class = get_filterset_class(cls.custom_filterset_class)
args = {}
for name, filter_field in cls.filterset_class.base_filters.items():
diff --git a/saleor/graphql/giftcard/filters.py b/saleor/graphql/giftcard/filters.py
index d24aa18394..7e2720adad 100644
--- a/saleor/graphql/giftcard/filters.py
+++ b/saleor/graphql/giftcard/filters.py
@@ -3,13 +3,17 @@ from typing import List
import django_filters
import graphene
from django.db.models import Exists, OuterRef
-from graphene_django.filter import GlobalIDMultipleChoiceFilter
from graphql.error import GraphQLError
from ...account import models as account_models
from ...giftcard import models
from ...product import models as product_models
-from ..core.filters import ListObjectTypeFilter, MetadataFilterBase, ObjectTypeFilter
+from ..core.filters import (
+ GlobalIDMultipleChoiceFilter,
+ ListObjectTypeFilter,
+ MetadataFilterBase,
+ ObjectTypeFilter,
+)
from ..core.types import FilterInputObjectType
from ..core.types.common import PriceRangeInput
from ..utils import resolve_global_ids_to_primary_keys
diff --git a/saleor/graphql/order/filters.py b/saleor/graphql/order/filters.py
index ae8c836ed9..35b9a754f9 100644
--- a/saleor/graphql/order/filters.py
+++ b/saleor/graphql/order/filters.py
@@ -2,14 +2,18 @@ import django_filters
from django.db.models import Exists, IntegerField, OuterRef, Q
from django.db.models.functions import Cast
from django.utils import timezone
-from graphene_django.filter import GlobalIDMultipleChoiceFilter
from ...giftcard import GiftCardEvents
from ...giftcard.models import GiftCardEvent
from ...order.models import Order, OrderLine
from ...order.search import search_orders
from ...product.models import ProductVariant
-from ..core.filters import ListObjectTypeFilter, MetadataFilterBase, ObjectTypeFilter
+from ..core.filters import (
+ GlobalIDMultipleChoiceFilter,
+ ListObjectTypeFilter,
+ MetadataFilterBase,
+ ObjectTypeFilter,
+)
from ..core.types.common import DateRangeInput
from ..core.utils import from_global_id_or_error
from ..payment.enums import PaymentChargeStatusEnum
diff --git a/saleor/graphql/page/filters.py b/saleor/graphql/page/filters.py
index bb951725a8..d6fd66c942 100644
--- a/saleor/graphql/page/filters.py
+++ b/saleor/graphql/page/filters.py
@@ -1,9 +1,8 @@
import django_filters
from django.db.models import Q
-from graphene_django.filter import GlobalIDMultipleChoiceFilter
from ...page import models
-from ..core.filters import MetadataFilterBase
+from ..core.filters import GlobalIDMultipleChoiceFilter, MetadataFilterBase
from ..core.types import FilterInputObjectType
from ..utils import resolve_global_ids_to_primary_keys
from ..utils.filters import filter_by_id
diff --git a/saleor/graphql/payment/filters.py b/saleor/graphql/payment/filters.py
index afcdb09efc..e3b6bbeb13 100644
--- a/saleor/graphql/payment/filters.py
+++ b/saleor/graphql/payment/filters.py
@@ -1,6 +1,6 @@
import django_filters
-from graphene_django.filter import GlobalIDMultipleChoiceFilter
+from ..core.filters import GlobalIDMultipleChoiceFilter
from ..core.types import FilterInputObjectType
from .types import Payment
diff --git a/saleor/graphql/product/filters.py b/saleor/graphql/product/filters.py
index 9cf9d45904..e443ad600d 100644
--- a/saleor/graphql/product/filters.py
+++ b/saleor/graphql/product/filters.py
@@ -9,7 +9,6 @@ from django.db.models.expressions import ExpressionWrapper
from django.db.models.fields import IntegerField
from django.db.models.functions import Cast, Coalesce
from django.utils import timezone
-from graphene_django.filter import GlobalIDMultipleChoiceFilter
from ...attribute import AttributeInputType
from ...attribute.models import (
@@ -37,6 +36,7 @@ from ...warehouse.models import Allocation, Stock, Warehouse
from ..channel.filters import get_channel_slug_from_filter_data
from ..core.filters import (
EnumFilter,
+ GlobalIDMultipleChoiceFilter,
ListObjectTypeFilter,
MetadataFilterBase,
ObjectTypeFilter,
diff --git a/saleor/graphql/shipping/filters.py b/saleor/graphql/shipping/filters.py
index d75bafe037..d15d0a04ba 100644
--- a/saleor/graphql/shipping/filters.py
+++ b/saleor/graphql/shipping/filters.py
@@ -1,8 +1,8 @@
import django_filters
-from graphene_django.filter import GlobalIDMultipleChoiceFilter
from ...shipping.models import ShippingZone
from ..channel.types import Channel
+from ..core.filters import GlobalIDMultipleChoiceFilter
from ..core.types import FilterInputObjectType
from ..utils import resolve_global_ids_to_primary_keys
from ..utils.filters import filter_fields_containing_value
diff --git a/saleor/graphql/views.py b/saleor/graphql/views.py
index d685cc1572..99c18eb135 100644
--- a/saleor/graphql/views.py
+++ b/saleor/graphql/views.py
@@ -3,6 +3,7 @@ import hashlib
import json
import logging
import traceback
+from inspect import isclass
from typing import Any, Dict, List, Optional, Tuple, Union
import opentracing
@@ -14,8 +15,6 @@ from django.db.backends.postgresql.base import DatabaseWrapper
from django.http import HttpRequest, HttpResponseNotAllowed, JsonResponse
from django.shortcuts import render
from django.views.generic import View
-from graphene_django.settings import graphene_settings
-from graphene_django.views import instantiate_middleware
from graphql import GraphQLDocument, get_default_backend
from graphql.error import GraphQLError, GraphQLSyntaxError
from graphql.error import format_error as format_graphql_error
@@ -73,15 +72,11 @@ class GraphQLView(View):
self, schema=None, executor=None, middleware=None, root_value=None, backend=None
):
super().__init__()
- if schema is None:
- schema = graphene_settings.SCHEMA
if backend is None:
backend = get_default_backend()
- if middleware is None:
- middleware = graphene_settings.MIDDLEWARE
self.schema = self.schema or schema
if middleware is not None:
- self.middleware = list(instantiate_middleware(middleware))
+ self.middleware = list()
self.executor = executor
self.root_value = root_value
self.backend = backend
@@ -444,6 +439,14 @@ def obj_set(obj, path, value, do_not_replace):
return obj_set(obj[current_path], path[1:], value, do_not_replace)
+def instantiate_middleware(middlewares):
+ for middleware in middlewares:
+ if isclass(middleware):
+ yield middleware()
+ continue
+ yield middleware
+
+
def generate_cache_key(raw_query: str) -> str:
hashed_query = hashlib.sha256(str(raw_query).encode("utf-8")).hexdigest()
return f"{saleor_version}-{hashed_query}"
diff --git a/saleor/graphql/warehouse/filters.py b/saleor/graphql/warehouse/filters.py
index aebf4a6fb9..989de698f9 100644
--- a/saleor/graphql/warehouse/filters.py
+++ b/saleor/graphql/warehouse/filters.py
@@ -1,9 +1,8 @@
import django_filters
-from graphene_django.filter import GlobalIDMultipleChoiceFilter
from ...warehouse import WarehouseClickAndCollectOption
from ...warehouse.models import Stock, Warehouse
-from ..core.filters import EnumFilter
+from ..core.filters import EnumFilter, GlobalIDMultipleChoiceFilter
from ..core.types import FilterInputObjectType
from ..utils.filters import filter_by_query_param
from ..warehouse.enums import WarehouseClickAndCollectOptionEnum
diff --git a/saleor/settings.py b/saleor/settings.py
index c48ef78567..20b92a8273 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -234,7 +234,6 @@ INSTALLED_APPS = [
"django_prices",
"django_prices_openexchangerates",
"django_prices_vatlayer",
- "graphene_django",
"mptt",
"django_countries",
"django_filters",