The food in the table tags are a comma separated string, example: blue, guitar
I want to check whether the tags field in a database contains a keyword, such as in the table all the price of the item contains blue tags found out
I tried to filter used in, but an error AttributeError: 'NoneType' object has no attribute 'in_'
class Food (the Model) :
__tablename__='food'
Id=db. The Column (db. The Integer, primary_key=True)
Cat_id=db. The Column (db. The Integer, nullable=False, server_default=the FetchedValue ())
Name=db. The Column (the String (100), the nullable=False, server_default=the FetchedValue ())
Price=db. The Column (the Numeric (10, 2) and nullable=False)
Main_image=db. The Column (the String (100), the nullable=False, server_default=the FetchedValue ())
The summary=db. The Column (the String (10000), the nullable=False, server_default=the FetchedValue ())
Stock=db. The Column (db. The Integer, nullable=False, server_default=the FetchedValue ())
Tags=db. The Column (the String (200), the nullable=False, server_default=the FetchedValue ())
Status=db. The Column (db. The Integer, nullable=False, server_default=the FetchedValue ())
Updated_time=db. The Column (the DateTime, nullable=False, server_default=the FetchedValue ())
Created_time=db. The Column (the DateTime, nullable=False, server_default=the FetchedValue ())
Def query_price (self, goodsname) :
Obj=self. Query. The filter (self) tags) in_ (goodsname)). The first ()
Return obj. Price
Here is my query
goods_price=the Food (). Query_price (data_name)
Inquire of bosses have a good way to solve