You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
976 B
33 lines
976 B
from minibase.app import db
|
|
|
|
|
|
class table_printable:
|
|
def __init__(self, table, link_for_item, item_to_be_linked):
|
|
self.titles = table.__table__.columns.keys()
|
|
self.lines = table.query.all()
|
|
self.link_for_item = link_for_item
|
|
self.item_to_be_linked = item_to_be_linked
|
|
self.paginate = 0
|
|
|
|
# https://www.youtube.com/watch?v=PSWf2TjTGNY&list=PL-osiE80TeTs4UjLw5MM6OjgkjFeUxCYH&index=9
|
|
class table_printable_paginate:
|
|
def __init__(self, table, current_page, per_page, link_for_item, item_to_be_linked):
|
|
self.titles = table.__table__.columns.keys()
|
|
self.lines = table.query.paginate(page=current_page, per_page=per_page)
|
|
self.link_for_item = link_for_item
|
|
self.item_to_be_linked = item_to_be_linked
|
|
self.paginate = 1
|
|
|
|
|
|
def dbAdd(dbClass):
|
|
db.session.add(dbClass)
|
|
|
|
|
|
def dbCommit():
|
|
db.session.commit()
|
|
|
|
|
|
def dbAddAndCommit(dbClass):
|
|
db.session.add(dbClass)
|
|
db.session.commit()
|