28 lines
602 B
Python
28 lines
602 B
Python
from db.object_pool import ObjectPool
|
|
|
|
class Test:
|
|
def init(self, sID, name):
|
|
self.id = sID
|
|
self.name = name
|
|
|
|
return self
|
|
|
|
def init_from_data(self, data):
|
|
return self.init(*data)
|
|
|
|
def get_id(self):
|
|
return self.id
|
|
|
|
def get_name(self):
|
|
return self.name
|
|
|
|
def render_short(self):
|
|
return f'<div class="test-short"><a class="header-link">#{self.sID} {self.name}</a></div>'
|
|
|
|
class TestPool:
|
|
def __init__(self, db):
|
|
self.object_pool = ObjectPool("test", Test)
|
|
|
|
if db:
|
|
self.object_pool.load_from_db(db)
|