From a365ec20d71dae7bfb09276e86b29027ed467e61 Mon Sep 17 00:00:00 2001 From: Peter Kopias Date: Mon, 4 Dec 2023 16:48:19 +0100 Subject: [PATCH] add category --- model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/model.py b/model.py index 6c4487a..f0f4e20 100644 --- a/model.py +++ b/model.py @@ -44,13 +44,14 @@ def __init__(self): self.description = '' self.image = '' self.color = '' + self.category = '' def contains(self, txt: str): """Returns true if the resource contains the text.""" txt = txt.lower() if (txt in self.name.lower() or txt in self.description.lower() - or txt in self.key.lower()): + or txt in self.key.lower()) or txt in self.category.lower(): return True return False @@ -60,6 +61,7 @@ def to_dict(self): 'name': self.name, 'description': self.description, 'image': self.image, + 'category': self.category, 'color': self.color} def from_dict(self, d: dict): @@ -68,6 +70,7 @@ def from_dict(self, d: dict): self.description = d.get('description', '') self.image = d.get('image', '') self.color = d.get('color', '') + self.category = d.get('category', '') class Part(Resource):