2024-05-25 19:18:26 +03:00
|
|
|
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):
|
2024-05-28 17:47:08 +03:00
|
|
|
return f'<div class="test-short"><a class="test-link" href="/index.py?mode=view-test&id={self.id}"><span class="sub-label">#{self.id}</span><span class="main-label">{self.name}</span></a></div>'
|
2024-05-25 19:18:26 +03:00
|
|
|
|
|
|
|
class TestPool:
|
|
|
|
def __init__(self, db):
|
|
|
|
self.object_pool = ObjectPool("test", Test)
|
|
|
|
|
|
|
|
if db:
|
|
|
|
self.object_pool.load_from_db(db)
|