django-hashid-field
django-hashid-field copied to clipboard
Add logic to in lookup to select only the PK on subqueries
The default In lookup prep performs logic to make it such that developers do not have to explicitly call values('id') or values('pk') when writing subqueries on the ID value. This backports the same logic implemented today in the core In lookup class to make it work the same way for hashid fields.
The clear_ordering function is noted in Django 3 to have side effect bugs regarding certain array subqueries in Postgresql, and the clearing of the ordering was not added to the In class until Django 4 anyway, so the order clearing is only included in Django > 4.0 by default to keep behaviors consistent.
See django/django source for core implementation
Thank you for the PR, this looks good. I'll merge and publish soon, pending response on your other PR #76.