Release 0.35.0
π Highlights (contains BREAKING CHANGES)
This release contains a major refactor of how filters and ordering works with this library (#478).
Thank you very much for this excellent work @Kitefiko π
Some distinctions between the new API and the old API:
Filtering
- The previously deprecated
NOT
filters with a leadingn
were removing,NOT
is the only negation option from now on - New
DISTINCT: Boolean
option to call.distinct()
in the resulting QuerySet: https://strawberry-graphql.github.io/strawberry-django/guide/filters/#and-or-not-distinct - Custom filters can be defined using a method with the
@strawberry_django.filter_field
decorator: https://strawberry-graphql.github.io/strawberry-django/guide/filters/#custom-filter-methods - The default filter method can be overriden also by using a
@strawberry_django.filter_field
decorator: https://strawberry-graphql.github.io/strawberry-django/guide/filters/#overriding-the-default-filter-method - Lookups have been separated into multiple types to make sure the API is not exposing an invalid lookup for a given attribute (e.g. trying to filter a
BooleanField
by__range
): https://strawberry-graphql.github.io/strawberry-django/guide/filters/#generic-lookup-reference
IMPORTANT NOTE: If you find any issues and/or can't migrate your codebase yet, the old behaviour can still be achieved by setting USE_DEPRECATED_FILTERS=True
in your django settings: https://strawberry-graphql.github.io/strawberry-django/guide/filters/#legacy-filtering
Also, make sure to report any issues you find with the new API.
Ordering
- It is now possible to define custom ordering methods: https://strawberry-graphql.github.io/strawberry-django/guide/ordering/#custom-order-methods
- The
Ordering
enum have 4 more options:ASC_NULLS_FIRST
,ASC_NULLS_LAST
,DESC_NULLS_FIRST
andDESC_NULLS_LAST
: https://strawberry-graphql.github.io/strawberry-django/guide/ordering/#ordering - The default order method can now be overridden for the entire resolution: https://strawberry-graphql.github.io/strawberry-django/guide/ordering/#overriding-the-default-order-method
There are no breaking changes in the new ordering API, but please report any issues you find when using it.
New Contributors
Full Changelog: v0.34.0...v0.35.0