2 ms·
How would you model string comparisons with LIKE?
by 7bit 2mo ago
How would you model string comparisons with LIKE?
- BrenBarn 2mo agoFor those you would have a method on the field object (e.g., `Table.field.like("whatever")`).
- 7bit 2mo agoYeah, but that's different from the operator. It's a different way of thinking about it. Maybe that's the reason they used dou le underscores for everything, to keep it consistent.
- BrenBarn 2mo agoNot really. Both method calls and operators are consistent with how Python normally works. Outside of Django you never do `obj__op(value)` or `obj__meth(value)` to do the equivalent of `obj op value` or `obj.meth(value)`. It is Django that is inconsistent with how operations are done in Python.