wip
This commit is contained in:
parent
f5c8e9ee23
commit
3a16f266da
15 changed files with 511 additions and 169 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -48,10 +48,18 @@ class Category(db.Model):
|
|||
def __repr__(self):
|
||||
return f'<Category {self.name}>'
|
||||
|
||||
@property
|
||||
def display_name(self):
|
||||
"""Return a display name for the category, showing 'Root' for the root category with empty name"""
|
||||
if self.is_root and not self.name:
|
||||
return "Root"
|
||||
return self.name
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
'id': self.id,
|
||||
'name': self.name,
|
||||
'name': self.name or '', # Ensure name is never null
|
||||
'display_name': self.display_name,
|
||||
'icon': self.icon,
|
||||
'description': self.description,
|
||||
'parent_id': self.parent_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue