mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-03 03:43:28 +03:00
Merge branch 'main' into proxy-model-supports-reverse-relationship
This commit is contained in:
commit
2900d444b2
4
.github/workflows/deploy.yml
vendored
4
.github/workflows/deploy.yml
vendored
|
@ -11,10 +11,10 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Set up Python 3.10
|
- name: Set up Python 3.11
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.11'
|
||||||
- name: Build wheel and source tarball
|
- name: Build wheel and source tarball
|
||||||
run: |
|
run: |
|
||||||
pip install wheel
|
pip install wheel
|
||||||
|
|
4
.github/workflows/lint.yml
vendored
4
.github/workflows/lint.yml
vendored
|
@ -8,10 +8,10 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Set up Python 3.10
|
- name: Set up Python 3.11
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.11'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
|
|
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
|
@ -13,6 +13,8 @@ jobs:
|
||||||
include:
|
include:
|
||||||
- django: "3.2"
|
- django: "3.2"
|
||||||
python-version: "3.7"
|
python-version: "3.7"
|
||||||
|
- django: "4.1"
|
||||||
|
python-version: "3.11"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
default_language_version:
|
default_language_version:
|
||||||
python: python3.10
|
python: python3.11
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.4.0
|
rev: v4.4.0
|
||||||
|
|
|
@ -96,7 +96,12 @@ def convert_choices_to_named_enum_with_descriptions(name, choices):
|
||||||
def description(self):
|
def description(self):
|
||||||
return str(named_choices_descriptions[self.name])
|
return str(named_choices_descriptions[self.name])
|
||||||
|
|
||||||
return_type = Enum(name, list(named_choices), type=EnumWithDescriptionsType)
|
return_type = Enum(
|
||||||
|
name,
|
||||||
|
list(named_choices),
|
||||||
|
type=EnumWithDescriptionsType,
|
||||||
|
description="An enumeration.", # Temporary fix until https://github.com/graphql-python/graphene/pull/1502 is merged
|
||||||
|
)
|
||||||
return return_type
|
return return_type
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
React,
|
React,
|
||||||
ReactDOM,
|
ReactDOM,
|
||||||
graphqlWs,
|
graphqlWs,
|
||||||
|
GraphiQLPluginExplorer,
|
||||||
fetch,
|
fetch,
|
||||||
history,
|
history,
|
||||||
location,
|
location,
|
||||||
|
@ -98,24 +99,44 @@
|
||||||
function updateURL() {
|
function updateURL() {
|
||||||
history.replaceState(null, null, locationQuery(parameters));
|
history.replaceState(null, null, locationQuery(parameters));
|
||||||
}
|
}
|
||||||
var options = {
|
|
||||||
fetcher: graphQLFetcher,
|
function GraphiQLWithExplorer() {
|
||||||
onEditQuery: onEditQuery,
|
var [query, setQuery] = React.useState(parameters.query);
|
||||||
onEditVariables: onEditVariables,
|
|
||||||
onEditOperationName: onEditOperationName,
|
function handleQuery(query) {
|
||||||
isHeadersEditorEnabled: GRAPHENE_SETTINGS.graphiqlHeaderEditorEnabled,
|
setQuery(query);
|
||||||
shouldPersistHeaders: GRAPHENE_SETTINGS.graphiqlShouldPersistHeaders,
|
onEditQuery(query);
|
||||||
query: parameters.query,
|
}
|
||||||
};
|
|
||||||
if (parameters.variables) {
|
var explorerPlugin = GraphiQLPluginExplorer.useExplorerPlugin({
|
||||||
options.variables = parameters.variables;
|
query: query,
|
||||||
}
|
onEdit: handleQuery,
|
||||||
if (parameters.operation_name) {
|
});
|
||||||
options.operationName = parameters.operation_name;
|
|
||||||
|
var options = {
|
||||||
|
fetcher: graphQLFetcher,
|
||||||
|
plugins: [explorerPlugin],
|
||||||
|
defaultEditorToolsVisibility: true,
|
||||||
|
onEditQuery: handleQuery,
|
||||||
|
onEditVariables: onEditVariables,
|
||||||
|
onEditOperationName: onEditOperationName,
|
||||||
|
isHeadersEditorEnabled: GRAPHENE_SETTINGS.graphiqlHeaderEditorEnabled,
|
||||||
|
shouldPersistHeaders: GRAPHENE_SETTINGS.graphiqlShouldPersistHeaders,
|
||||||
|
query: query,
|
||||||
|
};
|
||||||
|
if (parameters.variables) {
|
||||||
|
options.variables = parameters.variables;
|
||||||
|
}
|
||||||
|
if (parameters.operation_name) {
|
||||||
|
options.operationName = parameters.operation_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return React.createElement(GraphiQL, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render <GraphiQL /> into the body.
|
// Render <GraphiQL /> into the body.
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
React.createElement(GraphiQL, options),
|
React.createElement(GraphiQLWithExplorer),
|
||||||
document.getElementById("editor"),
|
document.getElementById("editor"),
|
||||||
);
|
);
|
||||||
})(
|
})(
|
||||||
|
@ -126,6 +147,7 @@
|
||||||
window.React,
|
window.React,
|
||||||
window.ReactDOM,
|
window.ReactDOM,
|
||||||
window.graphqlWs,
|
window.graphqlWs,
|
||||||
|
window.GraphiQLPluginExplorer,
|
||||||
window.fetch,
|
window.fetch,
|
||||||
window.history,
|
window.history,
|
||||||
window.location,
|
window.location,
|
||||||
|
|
|
@ -36,6 +36,9 @@ add "&raw" to the end of the URL within a browser.
|
||||||
<script src="https://cdn.jsdelivr.net/npm/graphql-ws@{{subscriptions_transport_ws_version}}/umd/graphql-ws.min.js"
|
<script src="https://cdn.jsdelivr.net/npm/graphql-ws@{{subscriptions_transport_ws_version}}/umd/graphql-ws.min.js"
|
||||||
integrity="{{subscriptions_transport_ws_sri}}"
|
integrity="{{subscriptions_transport_ws_sri}}"
|
||||||
crossorigin="anonymous"></script>
|
crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/@graphiql/plugin-explorer@{{graphiql_plugin_explorer_version}}/dist/graphiql-plugin-explorer.umd.js"
|
||||||
|
integrity="{{graphiql_plugin_explorer_sri}}"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="editor"></div>
|
<div id="editor"></div>
|
||||||
|
|
|
@ -76,6 +76,9 @@ class GraphQLView(View):
|
||||||
"sha256-EZhvg6ANJrBsgLvLAa0uuHNLepLJVCFYS+xlb5U/bqw="
|
"sha256-EZhvg6ANJrBsgLvLAa0uuHNLepLJVCFYS+xlb5U/bqw="
|
||||||
)
|
)
|
||||||
|
|
||||||
|
graphiql_plugin_explorer_version = "0.1.15"
|
||||||
|
graphiql_plugin_explorer_sri = "sha256-3hUuhBXdXlfCj6RTeEkJFtEh/kUG+TCDASFpFPLrzvE="
|
||||||
|
|
||||||
schema = None
|
schema = None
|
||||||
graphiql = False
|
graphiql = False
|
||||||
middleware = None
|
middleware = None
|
||||||
|
@ -158,6 +161,8 @@ class GraphQLView(View):
|
||||||
graphiql_css_sri=self.graphiql_css_sri,
|
graphiql_css_sri=self.graphiql_css_sri,
|
||||||
subscriptions_transport_ws_version=self.subscriptions_transport_ws_version,
|
subscriptions_transport_ws_version=self.subscriptions_transport_ws_version,
|
||||||
subscriptions_transport_ws_sri=self.subscriptions_transport_ws_sri,
|
subscriptions_transport_ws_sri=self.subscriptions_transport_ws_sri,
|
||||||
|
graphiql_plugin_explorer_version=self.graphiql_plugin_explorer_version,
|
||||||
|
graphiql_plugin_explorer_sri=self.graphiql_plugin_explorer_sri,
|
||||||
# The SUBSCRIPTION_PATH setting.
|
# The SUBSCRIPTION_PATH setting.
|
||||||
subscription_path=self.subscription_path,
|
subscription_path=self.subscription_path,
|
||||||
# GraphiQL headers tab,
|
# GraphiQL headers tab,
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -51,6 +51,7 @@ setup(
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
"Programming Language :: Python :: 3.9",
|
"Programming Language :: Python :: 3.9",
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
|
"Programming Language :: Python :: 3.11",
|
||||||
"Programming Language :: Python :: Implementation :: PyPy",
|
"Programming Language :: Python :: Implementation :: PyPy",
|
||||||
"Framework :: Django",
|
"Framework :: Django",
|
||||||
"Framework :: Django :: 3.2",
|
"Framework :: Django :: 3.2",
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -2,6 +2,7 @@
|
||||||
envlist =
|
envlist =
|
||||||
py{37,38,39,310}-django32,
|
py{37,38,39,310}-django32,
|
||||||
py{38,39,310}-django{40,41,main},
|
py{38,39,310}-django{40,41,main},
|
||||||
|
py311-django{41,main}
|
||||||
pre-commit
|
pre-commit
|
||||||
|
|
||||||
[gh-actions]
|
[gh-actions]
|
||||||
|
@ -10,6 +11,7 @@ python =
|
||||||
3.8: py38
|
3.8: py38
|
||||||
3.9: py39
|
3.9: py39
|
||||||
3.10: py310
|
3.10: py310
|
||||||
|
3.11: py311
|
||||||
|
|
||||||
[gh-actions:env]
|
[gh-actions:env]
|
||||||
DJANGO =
|
DJANGO =
|
||||||
|
|
Loading…
Reference in New Issue
Block a user