0

I have the following peewee model:

class Product(peewee.Model):
    key = peewee.IntegerField(unique=True)
    name = peewee.CharField(null=False)
    is_active = peewee.CharField(null=True)
    base_price = peewee.IntegerField(null=True)

I would like to search all Products that contains in its column "name" the word "foo".

  1. Can it be done with Product.get() ?
  2. Which is the right syntax to achieve it?

Thanks,

M.E.
  • 4,955
  • 4
  • 49
  • 128

1 Answers1

0

In case it helps someone else:

Product.select().where(Product.name.contains(text))

where text contains the pattern to search (case-insensitive).

M.E.
  • 4,955
  • 4
  • 49
  • 128