Commit Graph

193 Commits

Author SHA1 Message Date
Jonathan Kim
07c51092e1
Rename op_name to operation_name (#941) 2020-05-09 12:25:24 +01:00
Jean-Louis Fuchs
10d22de98e
graphql 3.0 and graphene 3.0 final rebase (#951) 2020-05-09 12:13:47 +01:00
Jack W
894c564ab7
Convert nullable BooleanField to nullable Boolean. (#777) 2020-05-09 12:09:17 +01:00
Jonathan Kim
9bb0554c94 Merge branch 'master' into v3 2020-04-20 13:24:19 +01:00
Jean-Louis Fuchs
b9f0e4f9ae
Make tests order independent (#932)
* Reset the global registry after each test (teardown)

* Create a settings fixtures that returns graphene_settings and resets
  the graphene_settings after use (teardown)

* Convert test_mutation tests from unittests.TestCase to pytest

* Convert test_mutation PetType to a pet_type fixtures that reregisters
  the type
2020-04-20 13:23:20 +01:00
Noelle Leigh
dc5c971498
Switch operation_name to operationName in GraphQLTestCase (#936)
* Add op_name test

* Replace "operation_name" with "operationName"

* Improve test comments

* Add method for Python 2.7
2020-04-19 21:11:33 +01:00
Ü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
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
Jonathan Kim
4e1b82a8d8
Check exclude fields correctly (#873) 2020-02-17 11:08:44 +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
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
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
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
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
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
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
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
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
mvanlonden
94602c77c6 add reverse relation one to one query test 2019-06-09 12:41:04 -07:00
Paul Hallett
2bf7e7f66d
Fix importing error for GraphQLTestCase 2019-05-08 22:45:28 +01:00
Paul Hallett
e6ad5887ca
Introduce Black formatting, additional tests 2019-05-02 17:46:35 +01: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
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
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
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
36ac5626e9 Adds enhanced support for proxy models. 2019-03-27 17:09:25 +13:00
Syrus Akbary
21bad6105c
Merge pull request #472 from wsantos/master
Exclude id from mutation for create operations
2018-09-05 13:20:38 +02:00
Jay Hale
0314931f12 Removed Django < 1.11 compatibility checks from tests 2018-09-04 13:15:04 -04:00
Waldecir Santos
c1bd3c4c15 Exclude id from mutation, useful for create operations. 2018-07-22 23:35:11 +01:00
Syrus Akbary
54ef52e1c6 Reformatted files using black 2018-07-19 16:52:24 -07:00
Syrus Akbary
27a7c0e299 Added support for FilePathField 2018-06-05 14:39:51 -07:00
Syrus Akbary
bb6da28008 Merge branch 'master' into form_mutations 2018-06-05 13:31:29 -07:00
Syrus Akbary
a9e5beb9eb Merge branch 'master' into form_mutations
# Conflicts:
#	graphene_django/forms/converter.py
#	graphene_django/forms/tests/test_converter.py
2018-06-05 13:23:39 -07:00
Syrus Akbary
883d1778d5
Merge pull request #336 from urbandove/django2
support Django 2 + in tests
2018-06-05 13:02:09 -07:00
Syrus Akbary
7563045d75
Merge pull request #290 from DouglasConnect/fix-distinct-bug
Fix distinct bug
2018-06-05 12:57:19 -07:00
Syrus Akbary
33c6fdf5ab Added graphql-core min version to requirements 2018-06-05 01:24:53 -07:00
=
b331319aea Fix merge conflicts 2018-04-15 00:12:49 -04:00
Syrus Akbary
70dffa94e7
Merge pull request #212 from maqquettex/fix_cbv_inheritance
Inheritance support for GraphQLView (class attributes)
2018-03-29 23:19:29 -07:00
Syrus Akbary
d2c1e7c87b
Merge pull request #391 from mongkok/test-custom-meta-setdefault
Test DjangoObjectType custom meta .setdefault()
2018-03-29 21:02:35 -07:00
Daniel Bachler
c32340662c Remove print statement 2018-03-28 12:28:58 +02:00
Daniel Bachler
4d41160379 Update resolve method signature to 2.0 style in new test 2018-02-28 17:45:25 +01:00
Daniel Bachler
e05fbcc1b3 Fix failing unit test by handling cases where a connection is resolved involving a query with inner join and distinct that is then filtered and would be combined with a filtered queryset that is not distinct. 2018-02-28 14:41:47 +01:00
Daniel Bachler
23eb8eea80 Add failing test case 2018-02-28 14:41:47 +01:00
Syrus Akbary
dbd3957a9f
Merge pull request #340 from urbandove/qfactor
Fix qfactor rankings for HTTP-ACCEPT
2018-02-11 14:01:18 -08:00
Syrus Akbary
c0edb0c927
Merge pull request #373 from jm2242/proxy-model-support
Basic Proxy model support
2018-02-11 13:46:13 -08:00
=
12b022a49a Remove old test 2018-02-09 16:46:22 -05:00
Syrus Akbary
94ee97085f
Merge pull request #368 from sciyoshi/convert-date-time
Convert Date/Time/DateTime form fields to appropriate Graphene types
2018-02-08 12:15:00 -08:00
Syrus Akbary
adde400893
Merge pull request #335 from urbandove/master
models.DateField => graphene Date Scalar
2018-02-08 12:14:13 -08:00
Jonathan Mares
bfcfccfc8d undo cascade changes 2018-02-03 22:51:25 -05:00
=
1bf5da2a8d Remove commits related to django 2.0 support from pull request 2018-02-03 18:32:18 -05:00
Jonathan Mares
bc1d47efb5 fix a line break 2018-02-03 14:36:25 -05:00
Jonathan Mares
0b103417f9 on_delete param where needed due to django 2 requirements
added support for querying a model with objects that may be a proxy model, fixed and added tests

a few style changes
2018-02-03 11:10:04 -05:00
mongkok
55dc65753e Test custom meta .setdefault() 2018-02-03 21:12:35 +05:30
Syrus Akbary
e827b10e7b
Merge pull request #379 from mongkok/default-meta
Allow DjangoObjectType to have default meta
2018-02-02 15:06:09 -08:00
mongkok
3051374b46 Fix Python 2.7 super arguments 2018-02-03 03:23:10 +05:30
mongkok
b81e961c86 Test DjangoObjectType with custom meta #364 2018-02-03 03:16:58 +05:30
Anton Zhdan-Pushkin
3682fe0318 Test of inherited class 2018-02-01 16:39:06 +02:00
Samuel Cormier-Iijima
bb2d24ec27
Convert Date/Time/DateTime form fields to appropriate Graphene types 2018-02-01 09:57:24 +00:00
=
51f794edb6 Test Connectionfield with custom Manager 2017-12-12 12:52:32 -05:00
=
616c549d2c Fix ConnectionField Last Test 2017-12-12 12:49:02 -05:00
=
29935c2d33 Test Last works 2017-12-12 12:33:32 -05:00
=
de59d26968 Test: erro if last is greater than max - plus fix wrong variable 2017-12-12 12:24:11 -05:00
=
65e63026a0 Add tests 2017-12-11 21:23:00 -05:00
=
6008cb6de4 Fix qfactor rankings for HTTP-ACCEPT 2017-12-11 21:08:42 -05:00
=
f687406ac5 Add on_delete atrributes to test models foreignkeys 2017-12-07 13:00:22 -05:00
=
62c0694901 models.DateField corresponds to graphene Date Scalar 2017-12-05 15:04:29 -05:00
=
73706fa6bb Add on_delete atrributes to test models foreignkeys 2017-12-05 15:01:52 -05:00
Syrus Akbary
5661db88d1
Merge pull request #156 from aaxelb/master
Fix #87: Don't create duplicate Enums for fields with choices
2017-11-14 21:14:51 -08:00
Charles Haro
2a39f5d8ea Allow abstract Connection Class to DjangoObjectType
referred to as connection_class, it will instantiate the connection from the provided class or default to graphene.Connection if not supplied
2017-10-30 14:35:29 -07:00
Grant McConnaughey
666ddb2ff3 Merge form converter modules 2017-10-02 09:42:57 -05:00
Abram Booth
be20450a66 Don't break on inherited choices fields.
Store converted Django fields in the registry, so choices enums are not
created multiple times when inherited by child models.
2017-08-24 12:49:02 -04:00
Syrus Akbary
3d58148f03 Code adapted to new resolver API 2017-07-28 09:43:27 -07:00
Syrus Akbary
72529b70bb Fixed all tests and flake issues 2017-07-24 23:42:40 -07:00
Syrus Akbary
48bcccdac2 Improved integration with Graphene 2.0 2017-07-24 22:27:50 -07:00
Syrus Akbary
7263485225 Merge pull request #194 from dvdmgl/173-annotation-bug
Fix graphene 1.3 annotation bug
2017-06-28 20:53:01 -07:00
Syrus Akbary
7c52aa3c7f Merge pull request #180 from arianon/master
Make DjangoConnectionField compatible with Promise-based iterables.
2017-06-24 15:44:51 -07:00
Syrus Akbary
3667157e4a Merge pull request #145 from dotsbb/fix-too-broad-exception
Wrong error message "invalid JSON" when "RequestDataTooBig" raised
2017-06-24 15:44:15 -07:00
Syrus Akbary
7eb4106e7c Merge pull request #202 from patrick91/feature/up-django
Remove support to django 1.6 and 1.7
2017-06-24 15:43:35 -07:00
Patrick Arminio
82055ac109 Add missing imports 2017-06-23 13:05:11 +01:00
Patrick Arminio
712d57e043 Delete RelatedObject import 2017-06-23 12:51:19 +01:00
Patrick Arminio
7fd6125199 Fix compatibility with pypy 2017-06-23 12:48:32 +01:00
Patrick Arminio
245ebe3d91 Remove some compatility layers for django 1.6 2017-06-23 12:32:43 +01:00
David Miguel
b3c761b1c8 Fix graphene 1.3 annotation bug
Issue #173
2017-06-06 19:19:29 +01:00
Jacob Foster
74e4e1aa77 Drop reverse flag, remove duplicates in get_model_fields 2017-05-25 11:01:29 -05:00
Jacob Foster
ca06d74195 Make test sort for stable comparison 2017-05-22 17:36:00 -05:00
Jacob Foster
cfe38ae208 Add tests 2017-05-22 17:20:56 -05:00