Commit Graph

434 Commits

Author SHA1 Message Date
Ülgen Sarıkavak
dd0d6ef28f
Python 3 (#904)
* Remove Python 2 support

* Upgrade Python & Django versions

* Remove unsupported Django versions
* Remove unsupported Python versions
* Add Python 3.8

* Drop support for django-filter < 2

* Update LoginRequiredMixin doc link

* Remove redundant import

* Resolve RemovedInDjango40Warning warnings

* gql/graphene-django/graphene_django/tests/test_converter.py:175:
RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is
deprecated in favor of django.utils.translation.gettext_lazy().

* graphene-django/graphene_django/utils/utils.py:28:
RemovedInDjango40Warning: force_text() is deprecated in favor of
force_str().

* No need to use unicode strings with Python3

* Remove singledispatch dependency

singledispatch is inluded with Python >= 3.4, no need for external
package.
2020-04-06 13:21:07 +01:00
Jonathan Kim
150008aae5
v2.9.0 2020-03-13 10:13:46 +00:00
Jonathan Kim
c8a56f8857
Allow string references in DjangoListField (#885)
* Allow passing string references to DjangoListField

* Refactor logic to work with string imports
2020-03-13 10:05:35 +00:00
Jonathan Kim
348fcf37a0
Detect format from output file path (#868)
* Detect format from output file path

* Fix tests

* Add test for exporting graphql file

* Add some documentation
2020-03-13 10:04:55 +00:00
Jonathan Kim
b8e598d66d
Add options to override how Django Choice fields are converted t… (#860)
* Add new setting to create unique enum names

* Add specific tests for name generation

* Add schema test

* Rename settings field

* Rename setting

* Add custom function setting

* Add documentation

* Use format instead of f strings

* Update graphene_django/converter.py

Co-Authored-By: Syrus Akbary <me@syrusakbary.com>

* Fix tests

* Update docs

* Import function through import_string function

Co-authored-by: Syrus Akbary <me@syrusakbary.com>
2020-03-13 10:04:25 +00:00
Sergey Fursov
aeb04d5b5c
use actual root/variables/context args of the execute method (#878) 2020-02-23 09:50:40 +00:00
Sergey Protasov
235096362f
Update mutation.py (#811)
* Update mutation.py

* Add tests

Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
2020-02-23 09:49:39 +00:00
Amim Knabben
a12fc9299a
Exclude read_only fields from input (#882) 2020-02-23 09:48:33 +00:00
Gabor Markowski
7a14b77a41
fix a typo in the warning (#884) 2020-02-23 09:47:41 +00:00
B4rtware
6a19ab5a4b
use to_representation in favor of get_attribute (#848)
* use `to_represenation` in favor of `get_attribute`

* fix datetime type does get converted to a string

to_representation will convert the datetime field into a string representation. However the to_representation on the method field will only call its underlying method.

* fix add missing import

* apply black formatter

* add test for serializer method field

* apply black format

* improve backward compatibility

by using date's class contructor instead of fromisostring

* apply black format

* fix black format issue
2020-02-21 17:42:47 +00:00
Jonathan Kim
11dafd4c48
v2.8.2 2020-02-17 11:09:11 +00:00
Jonathan Kim
4e1b82a8d8
Check exclude fields correctly (#873) 2020-02-17 11:08:44 +00:00
Leeward Bound
83bc32bc9d
Adding support for disabling enum creation on SerializerMutation (#851) 2020-02-07 10:17:56 +00:00
Ben Howes
6b8c5bdefc
Allow for easier template overrides in graphiql (#863)
* don't replace <body>

* Update graphene_django/templates/graphene/graphiql.html

Co-Authored-By: Jonathan Kim <jkimbo@gmail.com>

* Fix editor styling and initialisation

Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
2020-02-07 10:16:11 +00:00
Jonathan Kim
f3f0608606
v2.8.1 2020-02-07 09:59:05 +00:00
Jonathan Kim
280b38f804
Only warn if a field doesn't exist on the Django model (#862)
* Only warn if a field doesn't exist on the Django model

Also don't warn if the field name matches a custom field.

* Expand warning messages
2020-02-07 09:55:38 +00:00
Ilya Zhelyabuzhsky
8ec456285b
Fix force_str deprecation warning (#858) 2020-01-29 10:06:38 +00:00
luto
62ecbae614 resolve django encoding deprecation warnings (#853)
https://docs.djangoproject.com/en/3.0/ref/utils/#django.utils.encoding.force_text
2020-01-20 21:05:20 +00:00
luto
08f67797d8 resolve django translation deprecation warnings (#847)
https://docs.djangoproject.com/en/3.0/releases/3.0/#id3
2020-01-11 14:52:41 +01:00
Jonathan Kim
96c38b4349
Update Django model form tests (#839)
* Clean up code and raise an exception if the model type is not found

* Update tests

* Fix tests
2020-01-11 14:49:44 +01:00
Jonathan Kim
399ad13a70
v2.8.0 2019-12-31 14:10:18 +00:00
Vyacheslav Matyukhin
efe210f8ac Validate Meta.fields and Meta.exclude on DjangoObjectType (#842)
Resolves #840
2019-12-31 13:55:45 +00:00
Vyacheslav Matyukhin
f661cf8335 Fix typo in exclude type checking test (#841) 2019-12-30 14:14:41 +00:00
dan-klasson
7940a7b954 added support for partial updates in serializers (#731)
* added support for partial updates in serializers

* Add test to verify partial updates

Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
2019-12-27 14:46:48 +00:00
cbergmiller
45df7445f4 Read csrftoken from DOM if no cookie is set (#826) 2019-12-27 14:26:42 +00:00
Chibuotu Amadi
b66a3f3479 Add headers arg to GraphQLTestCase.query (#827)
* Add headers arg to GraphQLTestCase.query

* fix headers NoneType case in GraphQLTestCase.query

* Run format

Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
2019-12-26 11:45:18 +00:00
Jonathan Kim
374d8a8a9e
v2.7.1 2019-11-29 09:13:36 +00:00
Thiago Bellini Ribeiro
7e7f18ee0e Keep original queryset on DjangoFilterConnectionField (#816)
* Keep original queryset on DjangoFilterConnectionField

The PR #796 broke DjangoFilterConnectionField making it always get the
raw queryset from the model to apply the filters in it.

This makes sure that the DjangoObjectType's .get_queryset is called,
keeping any filtering it might have made.

* Add regression test
2019-11-29 09:13:16 +00:00
Jonathan Kim
e82a2d75c6
v2.7.0 2019-11-28 19:23:31 +00:00
Jason Kraus
a818ec9017 replace merge_queryset with resolve_queryset pattern (#796)
* replace merge_queryset with resolve_queryset pattern

* skip double limit test

* Update graphene_django/fields.py

Co-Authored-By: Jonathan Kim <jkimbo@gmail.com>

* yank skipped test

* fix bad variable ref

* add test for annotations

* add test for using  queryset with django filters

* document ththat one should use defer instead of values with queysets and DjangoObjectTypes
2019-11-28 10:49:37 +00:00
Jason Kraus
3ce44908c9 django-filter: resolve field along with lookup expression to pro… (#805)
* django-filter: resolve field along with lookup expression to properly resolve field

* bring back django-filter with method test

* remove dangling comment

* refactor based on better knowledge of django-filters
2019-11-28 10:48:03 +00:00
Misha K
b085b5922a add Django 3.0 to the test matrix (#793)
* add Django 3.0 to the test matrix

* fix six imports
2019-10-18 11:38:59 +01:00
Jonathan Kim
5068ea05c3
v2.6.0 2019-09-22 21:17:44 +01:00
Jonathan Kim
e4cf59ecec
Handle isnull filters differently (#753)
* Handle isnull filters differently

* Change to rsplit
2019-09-22 21:14:59 +01:00
Jason Kraus
a64ba65bef convert DRF ChoiceField to Enum (#537)
* convert DRF ChoiceField to Enum, also impacts FilePathField

* Pep8 fixes

* DRF multiple choices field converts to list of enum

* apply black formatting
2019-09-22 21:13:12 +01:00
rishabh
cd73cab699 converter.py: Fix typo posgres->postgres (#765)
Fixes typo for HStoreField and RangeField
converters.
2019-09-22 21:10:21 +01:00
Gilly Ames
4f21750fc2 Upgrade graphiql version to fix history tool (#772)
Graphiql has a history tool that allows you to save and label favourites, but this version has a bug (fixed https://github.com/graphql/graphiql/issues/750). This change upgrades to the latest version.
2019-09-22 20:43:46 +01:00
Jonathan Kim
fea9b5b194 Extend DjangoListField to use model queryset if none defined (#732)
* Fix model property

* Only allow DjangoObjectTypes to DjangoListField

* Resolve model queryset by default

* Add some more tests to check behaviour
2019-09-17 09:14:18 -07:00
Talley Lambert
254e59c36f Adds variables arg to GraphQLTestCase.query (#699)
* add variables arg in GraphQLTestCase.query

* update GraphQLTestCase.query docstring and remove type check
2019-09-07 11:49:29 -07:00
Jonathan Kim
87aebdb630
v2.5.0 (#739) 2019-08-10 11:55:42 +01:00
Tomasz Kontusz
11605dcdc6 Make DjangoDebugContext wait for nested fields (#591)
* Make DjangoDebugContext wait for nested fields

This commit makes DjangoDebugContext wait for all field's promises,
even for fields that only started their resolvers after __debug was
resolved.

Fixes #293.

* Run format
2019-08-07 08:09:17 +01:00
Kike Isidoro
6e137da469 Check for filters defined on base filterset classes (#730)
* Check for filters defined on base filterset classes

* Make python2.7 compatible and run black

* Add filter method and use filter in test

* Check article headline and reformat
2019-08-07 08:04:04 +01:00
Alexandre Kirszenberg
59f4f134b5 Set converted Django connections to required (#610) 2019-08-01 09:31:18 -07:00
Jason Kraus
b1a9293016 fix choices enum: if field can be blank then it isnt required (#714) 2019-08-01 09:07:52 +01:00
Jonathan Kim
de98fb5812
v2.4.0 (#706) 2019-07-12 17:38:26 +01:00
Semyon Pupkov
224725039b Asserting status code before decoding json in assertResponseNoEr… (#708) 2019-07-11 20:32:07 +01:00
Jonathan Kim
b7e4937775
Alias only_fields as fields and exclude_fields as exclude (#691)
* Create new fields and exclude options that are aliased to exclude_fields and only_fields

* Update docs

* Add some checking around fields and exclude definitions

* Add all fields option

* Update docs to include `__all__` option

* Actual order of fields is not stable

* Update docs/queries.rst

Co-Authored-By: Semyon Pupkov <semen.pupkov@gmail.com>

* Fix example code

* Format code

* Start raising PendingDeprecationWarnings for using only_fields and exclude_fields

* Update tests
2019-07-09 14:03:11 +01:00
Pablo Burgos
a2103c19f4 Fix error of multiple inputs with the same type. When using same serializer. (#530) 2019-07-09 09:14:04 +01:00
Jonathan Kim
0988e0798a
Adds documentation to CAMELCASE_ERRORS setting (#689)
* Rename setting and add documentation

* Add examples

* Use `cls`
2019-07-08 22:22:08 +01:00
Jonathan Kim
aa30750d39 Bugfix: Correct filter types for DjangoFilterConnectionFields (#682)
* Get form field from Django model before defaulting to django-filter

* Add test

* Cleanup some flake8 warnings and pytest warnings

* Run isort and add black compatible config
2019-07-07 12:11:27 -07:00
Jonathan Kim
9aabe2cbe6
Remove duplicate ErrorType (#701) 2019-07-07 20:06:01 +01:00
Jonathan Kim
40ae7e53ec
Fix manager check in DjangoConnectionField (#693)
* Fix default manager check

* Add test
2019-07-02 19:37:50 +01:00
Jonathan Kim
54cc6a4b13
Enforce NonNull for returned related Sets and their content (#690)
* Enforce NonNull for returned related Sets and their content. https://github.com/graphql-python/graphene-django/issues/448

* Run format.

* Remove duplicate assertion
2019-06-25 16:30:30 +01:00
Konstantin Alekseev
e2e496f505 Apply camel case converter to field names in DRF errors (#514)
* Apply camel case converter to field names in DRF errors

* Implement recursive error camelize, add setting.
2019-06-25 09:40:29 +01:00
Jonathan Kim
692540cc78
Update flake8 (#688)
* Include setup.py in black formatting

* Add new flake8 plugins and update errors to look for

* Fix duplicate test name

* Don't use mutable data structure

* Install all dev dependencies for flake8 and black tox envs
2019-06-24 18:55:44 +01:00
Jonathan Kim
612ba5a4ea
Add convert_choices_to_enum option on DjangoObjectType Meta class (#674)
* Add convert_choices_to_enum meta option

* Add tests

* Run black

* Update documentation

* Add link to Django choices documentation

* Add test and documentation note

That setting to an empty list is the same as setting the value as False

* Fix Django warning in tests

* rst is not markdown
2019-06-17 18:48:29 +01:00
Jonathan Kim
775d2e3523
Update travis and tox (#667)
* Update travis and tox

* Use xenial distribution

* Don't install coveralls twice

* Add black and flake8 tox commands

* Remove Python 3.5 test for Django master

* Fix indent

* Ignore migrations

* Remove black for now

* Run black formatting (#668)

* Run black format

* Update makefile

* Add black to travis build
2019-06-10 20:54:30 -07:00
Alexandre Kirszenberg
96934c4614 Correctly propagate help_text as description for many-to-* relations (#579)
* Correctly propagate help_text as description for many-to-* relations

* Trigger build
2019-06-09 17:19:05 -07:00
Emil Goldsmith Olesen
fcc491fffb Add watch option to graphql_schema (#656)
* Add watch option to graphql_schema

* add documentation for grapql_schema --watch
2019-06-09 17:06:50 -07:00
Mel van Londen
a9a8d672e9
Merge pull request #600 from sierreis/filterset-class
Add support for filterset_class meta parameter
2019-06-09 16:48:46 -07:00
Mel van Londen
b271b259bd
Merge pull request #603 from abettke/fix/enhanced-proxy-model-support
Adds enhanced support for proxy models.
2019-06-09 16:47:10 -07:00
Emil Goldsmith Olesen
3cde872e28 Stop enforcing csrf checks in GraphQLTestCase (#658) 2019-06-09 16:30:48 -07:00
kamilkijak
c90c27f364 Add support for write_only fields in SerializerMutation (#555) 2019-06-09 16:25:34 -07:00
mvanlonden
94602c77c6 add reverse relation one to one query test 2019-06-09 12:41:04 -07:00
José Roberto Meza Cabrera
ce6e6dd6e1 Fixes O2O relations 2019-06-09 14:15:46 -05:00
José Roberto Meza Cabrera
67b21cb36f Revert "Drop old Django compatibility code"
This reverts commit 6acd917cf7.
2019-06-09 14:08:31 -05:00
mvanlonden
ddf8d24bf5 increment version to match release tag 2019-05-31 14:38:34 -07:00
Paul Hallett
b0cba398a1
Merge pull request #647 from dulmandakh/react-16.8.6
bump react to 16.8.6
2019-05-21 14:18:45 +01:00
Dulmandakh
7690c2c002 bump react to 16.8.6 2019-05-20 19:41:25 +08:00
Dulmandakh
49aedf171a bump graphiql to 0.13.0, and rename __debug to _debug due to __ limitations 2019-05-20 17:48:28 +08:00
zorig
ba64bceab0 graphiql version upgrade 2019-05-15 17:22:29 +08:00
Paul Hallett
e26a9f2a44
Merge pull request #631 from graphql-python/fix-628
Fix importing error for GraphQLTestCase
2019-05-13 18:12:22 +01:00
Mel van Londen
865c9535b9
Bugfix: FormMutation was always causing boolean fields to be required (#613)
Bugfix: FormMutation was always causing boolean fields to be required
2019-05-09 11:47:47 -07:00
Paul Hallett
2bf7e7f66d
Fix importing error for GraphQLTestCase 2019-05-08 22:45:28 +01:00
Paul Hallett
0d178b38fb
Merge pull request #609 from acu/fix-connection-field-required
Fix passing required=True to DjangoConnectionField
2019-05-06 12:01:12 +01:00
Paul Hallett
e6ad5887ca
Introduce Black formatting, additional tests 2019-05-02 17:46:35 +01:00
Alexandre Kirszenberg
b49d315a39 4 spaces 2019-05-01 15:49:54 +02:00
Mel van Londen
fb8a129752
Merge pull request #608 from GitRon/feature/base-test-class
Added test class for django api unittests and documentation
2019-04-27 09:16:23 -07:00
David Sanders
6acd917cf7
Drop old Django compatibility code 2019-04-15 05:53:30 -07:00
Ronny Vedrilla
29b8ea8398 Bugfix: FormMutation was always causing boolean fields to be required 2019-04-05 14:27:53 +02:00
Andrew Bettke
a7ee042e9d Merge branch 'master' of https://github.com/graphql-python/graphene-django into fix/enhanced-proxy-model-support 2019-04-01 22:15:16 +13:00
Patrick Arminio
923d8282c7 Fix duplicated ErrorType declaration (#539)
* Add failing test case

* Fix duplicated ErrorType declaration
2019-03-31 12:01:43 +01:00
Jason Kraus
0a5020bee1 Get queryset (#528)
* first attempt at adding get_queryset

* add queryset_resolver to DjangoConnectionField and fix test failures

* cleanup get_queryset API to match proposal as close as possible

* pep8 fix: W293

* document get_queryset usage

* add test for when get_queryset is defined on DjangoObjectType
2019-03-31 12:01:17 +01:00
Gary Donovan
fcc3de2a90 Allow graphql schema export to use a canonical representation (#439)
When we use the `graphql_schema` management command, the output can vary from run to run depending on arbitrary factors (because there is no guarantee made about the order used to output JSON dictionary keys). This makes it difficult to compare two schema's at different points in time.

We address this by including a new `canonical` flag to the command, which uses standard `json.dump` funcitonality to sort dictionary keys and force pretty-printed output.
2019-03-31 11:30:29 +01:00
Alexandre Kirszenberg
8beadc759f Correctly propagate NonNull to inner connection type 2019-03-30 19:43:11 +01:00
Ronny Vedrilla
3c11a980fe Python 2.7 syntax compat 2019-03-29 12:53:18 +01:00
Ronny Vedrilla
b491878c27 * Added test class for django api unittests and documentation how to use it 2019-03-29 11:51:40 +01:00
Andrew Bettke
959e98eeb0 Refactor to use formal to_global_id. 2019-03-28 09:56:10 +13:00
sierreis
d2f8bf730b Test exception when both filterset_class and filter_fields are set 2019-03-27 14:05:42 -04:00
Ronny Vedrilla
d5d0c519ce Replaced a copy-paste error causing one test case not to run 2019-03-27 15:21:15 +01:00
Andrew Bettke
a461e80ee4 Correctly encode / decode for python3+. 2019-03-27 17:56:06 +13:00
Andrew Bettke
83a2ad34cd Encode strings before passing to b64encode. 2019-03-27 17:28:56 +13:00
Andrew Bettke
980142dfcf Fix linting. 2019-03-27 17:24:13 +13:00
Andrew Bettke
36ac5626e9 Adds enhanced support for proxy models. 2019-03-27 17:09:25 +13:00
sierreis
132c4cb9d4 Fixed so that GrapheneFilterSetMixin is used with any provided filterset_class 2019-03-25 23:45:14 -04:00
sierreis
4d905a46ac Fixed flake8 lint error 2019-03-25 10:03:54 -04:00
sierreis
5c191b9062 Add support for filterset_class meta parameter
* Allow for use of either filter_fields or filterset_class
* Add tests to check that the behavior is similar to filter_fields
* Add documentation to show how to make use of the parameter
2019-03-25 00:38:49 -04:00
Adam Johnson
ea2cd9894f Always use HTTPS for CDN files (#498)
* Always use HTTPS for CDN files

There's no point using insecure, deprecated HTTP even if the current page is on HTTP.

* add integrity and crossorigin attributes
2019-03-19 20:34:10 +00:00
Jonathan Kim
297b807f96
Merge pull request #508 from danpalmer/graphiql-no-querystring
Improve Security of GraphiQL
2019-03-16 11:30:32 +00:00
Jonathan Kim
ce8fa7f9f2 Fix lint error 2019-03-09 22:39:04 +01:00