* 🔧 Add pre-commit config
Similar to graphene and graphene-sqlalchemy
* ⬆ Bump black
* 👷 Lint on CI
* ⬆ Bump flake8-black
* 🔧 Keep excluding migrations
* ⬆ Bump flake8
* 🔧 Remove black and flake8 from tox config
* ⬆ Update pre-commit versions
* Upgrade syntax to python 3.7+
* Format with pre-commit
dedent docs/schema.py to allow formatting
* Fix tests on python 3.7
* Cast translated description for DecimalField
https://github.com/graphql-python/graphene-django/pull/976 casts all the description fields to strings to prevent schema printing from failing whenever the description is a lazy translated string. The `DecimalField` however got in after the v3 merge and it currently misses the cast.
* Fix row size
* 👽 Use .formatted instead of format_error
* ✅ Fix test with newer graphene
null default values (graphql-python/graphene@03277a5)
no more trailing newlines
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).