Skip to content

Commit

Permalink
add category
Browse files Browse the repository at this point in the history
  • Loading branch information
Petrox committed Dec 4, 2023
1 parent 3069c23 commit a365ec2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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):
Expand All @@ -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):
Expand Down

0 comments on commit a365ec2

Please sign in to comment.