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

Chore: Refactor Django orcabus_id #784

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

williamputraintan
Copy link
Member

@williamputraintan williamputraintan commented Dec 17, 2024

Implement custom Django custom-model-field for orcabus_id to include prefixes.

Resolve #766

The Django custom works well and could pass with or without the prefix. A function is called to sanitize the orcabus_id before or after hitting the database.

operator.or_, (Q(**{"%s__iexact" % key: value})
# Apparently the `get_prep_value` from the custom fields.py is not called prior hitting the Db but,
# the regular `__exact` still execute that function.
operator.or_, (Q(**{"%s__exact" % key: value})
Copy link
Member Author

@williamputraintan williamputraintan Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One caveat I found here is the strip/annotation will not work if it uses iexact ( on the custom filtering we had that based on model). Currently, changing it to filter for only exact match.

@williamputraintan williamputraintan marked this pull request as ready for review December 18, 2024 05:48
@victorskl
Copy link
Member

.. will review in tick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chore: Refactor OrcaBus Id for Django
2 participants