I was writing a statement containing this where-clause in peewee:
.where(some_string.startswith(Record.text_field))
This expression raises TypeError: startswith first arg must be str or a tuple of str, not CharField
. some_string
is just a normal string, therefore startswith
is the method from the standard lib, not the one that is provided by peewee.
So it is clear, why that happens, but what is the correct way to write this expression?