def search_history(self, keyword: str): user_query = self.__search_user(keyword) book_query = self.__search_book(keyword) return DatabaseManager.get_list(BookCirculation.select().where( (BookCirculation.user << user_query) | (BookCirculation.book << book_query)))
def search_borrowing(self, keyword: str): user_query = self.__search_user(keyword) book_query = self.__search_book(keyword) return DatabaseManager.get_list(BookCirculation.select().where( ((BookCirculation.user << user_query) | (BookCirculation.book << book_query)) & BookCirculation.return_time.is_null(True)))
def get_all_books(self): return DatabaseManager.get_list( Book.select().where(Book.is_available == True))
def __init__(self): DatabaseManager.__init__(self) Book.create_table()
def search(self, keyword): return DatabaseManager.get_list( Book.select().where((Book.title.contains(keyword)) & (Book.is_available == True)))
def get_complete_history(self): return DatabaseManager.get_list(BookCirculation.select())
def get_all_being_borrowed(self): return DatabaseManager.get_list(BookCirculation.select().where( BookCirculation.return_time.is_null(True)))
from Manager.DatabaseManager import DatabaseManager from app import db db_manager = DatabaseManager(db) db_manager.add_interval(interval="15:25 - 17:00")
def __init__(self): DatabaseManager.__init__(self) BookCirculation.create_table()
def get_all_user(self): return DatabaseManager.get_list( User.select().where(User.is_active == True))
def search(self, keyword): return DatabaseManager.get_list( User.select().where((User.name.contains(keyword)) & (User.is_active == True)))
from flask.blueprints import Blueprint from flask import render_template from flask import request from Models.Subject import Subject from Models.Interval import Interval from Models.Group import Group from Models.Lecturer import Lecturer from Models.Schedule import Schedule from Manager.DatabaseManager import DatabaseManager from Routes.addlecturers import Lecturer from extensions import db import sqlalchemy.connectors db_manager = DatabaseManager(db) add_rasp = Blueprint('addrasp', __name__, template_folder='templates', static_folder='static') @add_rasp.route('/addrasp') def index(): return render_template('addrasp.html', lecturers=Lecturer.query.all(), intervals=Interval.query.all(), groups=Group.query.all(), subjects=Subject.query.all()) @add_rasp.route('/addrasp', methods=['post', 'get']) def add(): if request.method == 'POST':
from Manager.DatabaseManager import DatabaseManager from app import db db_manager = DatabaseManager(db) db_manager.add_subject(subjects='РиСПСиИТ')
from Manager.DatabaseManager import DatabaseManager from app import db db_manager = DatabaseManager(db) db_manager.add_group(groups='БФИ1801')