* 👽 Use .formatted instead of format_error
* ✅ Fix test with newer graphene
null default values (graphql-python/graphene@03277a5)
no more trailing newlines
* fixed broken links to graphene filter documentation (master->main)
* #1295 There is still a wrong link to github
The referenced example is in main branch
but the link goes to the master branch which still exists.
Co-authored-by: Peter Paul Kiefer <dafisppk@gmail.com>
Django's plain (non-model) forms don't have the `save` method, so
calling this would just result in an `AttributeError` before this
change.
Resolves#1152
* feat: add TypedFilter which allow to explicitly give a filter input GraphQL type
* Fix doc typo
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
* Add ability to pass `execution_context_class` to `GraphQLView.as_view()`
Currently when passing `execution_context_class` like this:
```
GraphQLView.as_view(execution_context_class=CustomContext)
```
you get the following error from `View.as_view()`
```
TypeError: GraphQLView() received an invalid keyword 'execution_context_class'. as_view only accepts arguments that are already attributes of the class.
```
this PR fixes the `hasattr` check in `.as_view`.
Fixes: #1072
* make black happy
removed whitespace
* Update Django's main branch name
* Add Python 3.9 to tox
* Update base gh action versions
* Add Django 3.2 to tests
* Remove redundant Django 1.11 references
* Update setup.py for new Django and Python versions
* Added GraphQLTransactionTestCase
- Adds support for testing code that is executed within a transaction
Reference: https://docs.djangoproject.com/en/3.1/topics/testing/tools/#django.test.TransactionTestCase
```
For instance, you cannot test that a block of code is executing within a transaction, as is required when using select_for_update(). In those cases, you should use TransactionTestCase.
```
* Update testing.py
* Update testing.py
* Fixed formatting.
* Updated docs.
* Updated test.
* Update testing.rst
* - Add filtering support for choice fields converted to graphql Enum (or not)
- Fix type of various filters (used to default to String)
- Fix bug with contains introduced in previous PR
- Fix bug with declared filters being overridden (see PR #1108)
- Fix support for ArrayField and add documentation
* Fix for v3
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
Without explicitly setting the encoding to "utf-8" I get the following error on windows (python 3.9)
```
File "D:\env\lib\site-packages\graphene_django\management\commands\graphql_schema.py", line 115, in handle
self.get_schema(schema, out, indent)
File "D:\env\lib\site-packages\graphene_django\management\commands\graphql_schema.py", line 72, in get_schema
self.save_graphql_file(out, schema)
File "D:\env\lib\site-packages\graphene_django\management\commands\graphql_schema.py", line 59, in save_graphql_file
outfile.write(print_schema(schema.graphql_schema))
File "C:\Users\u\AppData\Local\Programs\Python\Python39\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
```
I think it might be helpful to add an explicit hint that HTTP headers should be prepended with `HTTP_` as required by `django.test.Client` (at least it was not super obvious to me when I tried to use it).
* Use the Django Client test utility instance that Django provides with its TestCase class. This allows GraphQL tests to make use of the stateful client methods like login()
* Add missing test case initializer call
* Don't break backward compability
* Add test for pending deprecation warning on GraphQLTestCase._client
Co-authored-by: Tom Nightingale <tom@tnightingale.com>
* merge master into v3
* fix order_by snake casing by checking if value is None, switch executor to execution_context_class since schema.execute no longer supports executor
* fix linting by removing duplicate defintion and test of convert_form_field_to_string_list