Skip to main content

Write Django model properties that can be used in database queries.

Project description

https://github.com/W1ldPo1nter/django-queryable-properties/actions/workflows/test.yaml/badge.svg?branch=master https://codecov.io/gh/W1ldPo1nter/django-queryable-properties/branch/master/graph/badge.svg https://readthedocs.org/projects/django-queryable-properties/badge/?version=latest https://img.shields.io/pypi/v/django-queryable-properties.svg

django-queryable-properties is a Django extension that allows to implement model properties which can be used in database queries performed via Django’s ORM.

Further information, including supported Python and Django versions as well as installation instructions, can be found in the documentation hosted by readthedocs.

Contributing and getting help

The GitHub repository is the central place to report bugs and get help using the GitHub issues as well as to contribute to the project via pull requests while following the guide on contributing.

Changelog

master (unreleased)

1.6.0 (2021-04-06)

  • Added support for Django 3.2

  • Queryable properties can now define a verbose name that can be used in UI representations

  • Added a Django admin integration that allows to reference queryable properties like regular model fields in various admin options

  • Fixed the construction of GROUP BY clauses when using annotations based on aggregate queryable properties in Django 1.8

1.5.0 (2020-12-30)

  • Added an option to implement annotation-based properties that use their annotation to query their getter value from the database

  • Added a new ready-to-use queryable property implementation for properties that check whether or not certain related objects exist (RelatedExistenceCheckProperty)

  • Added a new ready-to-use queryable property implementation for properties that map field/attribute values to other values (MappingProperty)

1.4.1 (2020-10-21)

  • String representations of queryable properties do now contain the full Python path instead of the Django model path (also fixes an error that occurred when building the string representation for a property on an abstract model that was defined outside of the installed apps)

1.4.0 (2020-10-17)

  • ValueCheckProperty and RangeCheckProperty objects can now take more complex attribute paths instead of simple field/attribute names

  • RangeCheckProperty objects now have an option that determines how to treat missing values to support ranges with optional boundaries

  • Added a new ready-to-use queryable property implementation for properties based on simple aggregates (AggregateProperty)

1.3.1 (2020-08-04)

  • Added support for Django 3.1

  • Refactored decorator-based properties to be more maintainable and memory-efficient and documented a way to use them without actually decorating

1.3.0 (2020-05-22)

  • Added an option to implement simplified custom boolean filters utilizing lookup-based filters

  • Fixed the ability to use the classmethod or staticmethod decorators with lookup-based filter methods for decorator-based properties

  • Fixed the queryable property resolution in When parts of conditional updates

  • Fixed the ability to use conditional expressions directly in .filter/.exclude calls in Django 3.0

1.2.1 (2019-12-03)

  • Added support for Django 3.0

1.2.0 (2019-10-21)

  • Added a mixin that allows custom filters for queryable properties (both class- and decorator-based) to be implemented using multiple functions/methods for different lookups

  • Added some ready-to-use queryable property implementations (ValueCheckProperty, RangeCheckProperty) to simplify common code patterns

  • Added a standalone version of six to the package requirements

1.1.0 (2019-06-23)

  • Queryable property filters (both annotation-based and custom) can now be used across relations when filtering querysets (i.e. a queryset can now be filtered by a queryable property on a related model)

  • Queryset annotations can now refer to annotatable queryable properties defined on a related model

  • Querysets can now be ordered by annotatable queryable properties defined on a related model

  • Filters and annotations that reference annotatable queryable properties will not select the queryable property annotation anymore in Django versions below 1.8 (ordering by such a property will still lead to a selection in these versions)

  • Fixed unnecessary selections of queryable property annotations in querysets that don’t return model instances (i.e. queries with .values() or .values_list())

  • Fixed unnecessary fields in GROUP BY clauses in querysets that don’t return model instances (i.e. queries with .values() or .values_list()) in Django versions below 1.8

  • Fixed an infinite recursion when constructing the HAVING clause for annotation-based filters that are not an aggregate in Django 1.8

1.0.2 (2019-06-02)

  • The lookup parameter of custom filter implementations of queryable properties will now receive the combined lookup string if multiple lookups/transforms are used at once instead of just the first lookup/transform

  • Fixed the construction of GROUP BY clauses when annotating queryable properties based on aggregates

  • Fixed the construction of HAVING clauses when annotating queryable properties based on aggregates in Django versions below 1.9

  • Fixed the ability to pickle queries and querysets with queryable properties functionality in Django versions below 1.6

1.0.1 (2019-05-11)

  • Added support for Django 2.2

1.0.0 (2018-12-31)

  • Initial release

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-queryable-properties-1.6.0.tar.gz (60.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_queryable_properties-1.6.0-py2.py3-none-any.whl (78.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django-queryable-properties-1.6.0.tar.gz.

File metadata

  • Download URL: django-queryable-properties-1.6.0.tar.gz
  • Upload date:
  • Size: 60.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for django-queryable-properties-1.6.0.tar.gz
Algorithm Hash digest
SHA256 7618c0a5c60d4ff6cd9d8af97c7075f4437fb24d34f467928131720e75ae077d
MD5 2d5218060c0bb9df74273364fac2dfdb
BLAKE2b-256 ea797f6fde47811c8f0573a6eb1d4574d2d36868e8aa19ffe9dd81c67e64f725

See more details on using hashes here.

File details

Details for the file django_queryable_properties-1.6.0-py2.py3-none-any.whl.

File metadata

  • Download URL: django_queryable_properties-1.6.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 78.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for django_queryable_properties-1.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9639ade13d799bd1553bff4ada9b5a332bde0b51593c37a128815a2fbf9d758b
MD5 18f0c4354556bcd2d654c341bc6e0289
BLAKE2b-256 9b7f64de9dbe7f7b127456b955f7e6b7827bea52ce6ee5ec3e0040a8643f5342

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page