Commit Graph

102 Commits

Author SHA1 Message Date
Kien Dang
6f21dc7a94
Not require explicitly set ordering in DjangoConnectionField (#1518)
* Revert "feat!: check django model has a default ordering when used in a relay connection (#1495)"

This reverts commit 96c09ac439.

* Fix assert no warning for pytest>=8
2024-04-18 12:00:31 +08:00
Thomas Leonard
96c09ac439
feat!: check django model has a default ordering when used in a relay connection (#1495)
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2024-01-30 12:09:18 +03:00
Kien Dang
36cf100e8b
Use ruff format to replace black (#1473)
* Use ruff format to replace black

* Adjust ruff config to be compatible with ruff-format

https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules

* Format

* Replace black with ruff format in Makefile
2023-10-25 11:33:00 +03:00
lilac-supernova-2
67def2e074
Typo fixes (#1459)
* Fix Star Wars spaceship name

* Fix some typos in comments

* Typo fixes

* More typo fixes
2023-09-06 10:29:58 +03:00
Thomas Leonard
0473f1a9a3
fix: empty list is not an empty value for list filters even when a custom filtering method is provided (#1450)
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2023-08-11 23:24:58 +08:00
Kien Dang
9a773b9d7b
Use ruff in pre-commit (#1441)
* Use ruff in pre-commit

* Add pyupgrade

* Add isort

* Add bugbear

* Fix B015 Pointless comparison

* Fix B026

* B018 false positive

* Remove flake8 and isort config from setup.cfg

* Remove black and flake8 from dev dependencies

* Update black

* Show list of fixes applied with autofix on

* Fix typo

* Add C4 flake8-comprehensions

* Add ruff to dev dependencies

* Fix up
2023-08-06 01:47:00 +03:00
Firas K
af8888f58e
Upgrade github actions versions, default python and dev dependencies (#1407)
* Use Python 3.10 for deployments on PyPi

* Update gh-action-pypi-publish version

* Update python version

* Update checkout and setup-python versions

* Upgrade dev dependencies

* fromat examples and few files to follow black new version

* Upgrade pytest version

---------

Co-authored-by: Firas Kafri <firaskafri@Firass-MacBook-Pro-2.local>
2023-05-03 13:25:16 +03:00
Nikolai Røed Kristiansen
4517e32224
👷 Add pre-commit (#1336)
* 🔧 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
2022-10-19 17:10:30 +03:00
Thomas Leonard
a53ded611b
feat: update name of DjangoFilterConnectionField type input to be consistent with graphene (Issue #1316) (#1317)
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2022-09-22 19:09:29 +01:00
Thomas Leonard
42a40b4df0
chore: update dev dependencies (#1345)
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2022-09-22 10:26:21 +01:00
Nikolai Røed Kristiansen
5f1731dca3
Fix: Use .formatted instead of format_error (#1327) & Fix tests
* 👽 Use .formatted instead of format_error

*  Fix test with newer graphene

null default values (graphql-python/graphene@03277a5)
no more trailing newlines
2022-08-15 11:41:39 +02:00
Jarkko Piiroinen
e1a7d19833
Convert DecimalField to Decimal instead of Float in DRF and form converters (#1277)
* Convert serializer DecimalField to Decimal

* Convert form DecimalField to Decimal
2022-01-18 17:03:08 +03:00
Thomas Leonard
80ea51fc3b
Add typed filters (v3) (#1148)
* feat: add TypedFilter which allow to explicitly give a filter input GraphQL type

* Fix doc typo

Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2021-03-31 10:31:45 -07:00
Tonye Jack
212524fd8c
Cleaned up unused imports and variables. (#1146)
* Cleaned up used imports and variables.
* Optimized imports.
* Fixed mixed imports.
2021-03-18 12:26:02 +03:00
Sebastián Sastoque H
fe66b48d38
Fix main branch tests failing due to wrong instancing of Missing class (#1135)
Co-authored-by: Sebastian Hernandez <sebastian@rhinoafrica.com>
2021-03-02 10:46:35 -08:00
Thomas Leonard
6046a710c8
fix: declaration of required variable in filters v3 (#1137)
* fix: declaration of required variable

* Add unit test

* Fix formating

Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2021-02-26 14:44:43 -08:00
Thomas Leonard
2d4ca0ac7b
Add enum support to filters and fix filter typing (v3) (#1119)
* - 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>
2021-02-22 20:21:32 -08:00
Jason Kraus
4573d3db53
Fix test main (#1126)
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2021-02-20 14:26:06 -08:00
Lucas
5dea6ffa41
Support "contains" and "overlap" filtering (v3) (#1101)
* Support contains/overlap filters

* Remove unused fixtures
2021-01-18 21:39:22 -08:00
Thomas Leonard
10e48c27b7
Validate in and range filter inputs (#1090)
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2021-01-09 19:15:21 -08:00
Jason Kraus
8324d47999 Merge branch 'v2' into main 2020-12-30 22:31:41 -08:00
Thiago Bellini Ribeiro
8c48516093
Also convert BaseCSVFilter for custom fields (#1081) 2020-12-30 21:03:57 -08:00
Jason Kraus
c049ab7470
WIP: Merge master into v3 (#1086)
* 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
2020-12-30 15:37:57 -08:00
Semyon Pupkov
a51c2bffd9
Allow to use camel case in order by field (#1054)
Fixes #1008
2020-12-22 20:15:38 -08:00
Thomas Leonard
99512c53a1
fix: in and range filters on DjangoFilterConnectionField (#1070)
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2020-12-22 20:10:39 -08:00
Thomas Leonard
2140be5e6a
Add offset pagination (#1013)
* Add offset filtering

* Formatting

Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2020-10-26 09:09:21 -07:00
Jonathan Kim
da9f41c295 Rename get_resolver -> wrap_resolve and fix tests 2020-08-06 20:45:30 +01:00
Jonathan Kim
965ebdee13 Merge branch 'master' into v3 2020-06-27 11:14:09 +01:00
Hubert Siuzdak
3c6733e121
Fix filtering with GlobalIDFilter (#977) 2020-06-25 12:56:06 +01:00
Radosław Kowalski
1f752b6cad
Warn if fields or exclude are not defined on DjangoObjectType (#981) 2020-06-11 11:09:52 +01:00
DoctorJohn
26c4c48abc
Fix that generated schemas could contain empty descriptions (v3) (#984) 2020-06-10 17:21:37 +01:00
DoctorJohn
b320b94a73
(v3) Cast potentially translated strings used as descriptions (#976) 2020-06-06 17:08:10 +01:00
Jean-Louis Fuchs
10d22de98e
graphql 3.0 and graphene 3.0 final rebase (#951) 2020-05-09 12:13:47 +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
Ü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
Sergey Fursov
aeb04d5b5c
use actual root/variables/context args of the execute method (#878) 2020-02-23 09:50:40 +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
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
Jonathan Kim
e4cf59ecec
Handle isnull filters differently (#753)
* Handle isnull filters differently

* Change to rsplit
2019-09-22 21:14:59 +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
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
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
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
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
a9a8d672e9
Merge pull request #600 from sierreis/filterset-class
Add support for filterset_class meta parameter
2019-06-09 16:48:46 -07:00
Paul Hallett
e6ad5887ca
Introduce Black formatting, additional tests 2019-05-02 17:46:35 +01:00
sierreis
d2f8bf730b Test exception when both filterset_class and filter_fields are set 2019-03-27 14:05:42 -04:00