Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BaseDatabaseWrapper.operators #1119

Merged
merged 1 commit into from
Aug 26, 2022

Conversation

adamchainz
Copy link
Contributor

I have made things!

BaseDatabaseWrapper itself doesn't include this attribute, but all subclasses are required to add it for the ORM to work. For example in the dummy backend and postgresql.

I used MutableMapping for a broader type, because at least the Oracle backend uses a funky descriptor.

Using connection.operators is useful when implementing some ORM functions like custom lookups. The case I came across was in django-countries: https://github.com/smileychris/django-countries/blob/5bb48218ef77662b8287d979d652bc716082fe67/django_countries/fields.py#L470-L471

Related issues

n/a

@adamchainz adamchainz force-pushed the db_wrapper_operations branch from 2165eaf to 1c1804d Compare August 26, 2022 09:15
@sobolevn sobolevn merged commit f626448 into typeddjango:master Aug 26, 2022
@adamchainz adamchainz deleted the db_wrapper_operations branch August 26, 2022 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants