Exemplo n.º 1
0
def books():
    db = DbFunctions()
    books = db.get_book_names()
    dictionary = []
    
    for i in books:
        case = {'link': 'labels/books/{}.png'.format(i), 'name': i}
        dictionary.append(case)
Exemplo n.º 2
0
def ids():
    db = DbFunctions()
    names = db.get_student_names()
    dictionary = []
    
    for i in names:
        case = {'link': 'labels/students/{}.png'.format(i), 'name': i}
        dictionary.append(case)
Exemplo n.º 3
0
def checkout():
    db = DbFunctions()
    book_list = []
    student_name = request.form['student_name']
    book_names = request.form['book_names']
    
    split_list = book_names.split(',')
    
    for i in split_list:
        book_list.append(i.strip())

    for i in book_list:
        db.update_current_user(i, student_name)
    
    return redirect(url_for("update"))
Exemplo n.º 4
0
class MainFunctions():
    def __init__(self, book_name, student_name, session):
        self.student_name = student_name
        self.book_name = book_name
        self.session = session
        self.db = DbFunctions()

    def checkout(self):
        print("Updating the book: {} with the new student: {}".format(
            self.book_name, self.student_name))
        book = self.session.query(Book).filter_by(name=self.book_name).first()
        student = self.session.query(Student).filter_by(
            name=self.student_name).first()

        if book != None and student != None:
            self.db.update_current_user(self.book_name, self.student_name)
        else:
            print("Check inputs")
Exemplo n.º 5
0
    def create_labels(self):
        db = DbFunctions()

        book_names = db.get_book_names()
        student_names = db.get_student_names()

        for i in book_names:
            '''
                the pyqrcode.create() function takes the information that the qrcode will display as a parameter. Code.png depends on pypng in order to run
            '''
            print(i)
            code = pyqrcode.create(i)
            code.png('static/labels/books/{}.png'.format(i), scale=5)

        for i in student_names:

            code = pyqrcode.create(i)
            code.png('static/labels/students/{}.png'.format(i), scale=5)

        print("Finished creating labels")
Exemplo n.º 6
0
def admin():
    db = DbFunctions()
    books = db.query_books_database()
    return render_template('admin.html', table=books)
Exemplo n.º 7
0
def update():
    db = DbFunctions()
    students = db.get_student_names()
    books = db.get_book_names()

    return render_template('form.html', names = students, books = books)
Exemplo n.º 8
0
 def __init__(self, book_name, student_name, session):
     self.student_name = student_name
     self.book_name = book_name
     self.session = session
     self.db = DbFunctions()
Exemplo n.º 9
0
import sys

from databaseFunctions.database_functions import DbFunctions
from labelmaking.createlabels import Create_Labels
from main_functions.main_functions import MainFunctions

db = DbFunctions()

#------------------------------------------------Create------------------------------------------------------#
if sys.argv[1] == '1':
    labelmaker = Create_Labels()

    db.create_db()
    db.populate_book_table()
    db.populate_student_table()
    labelmaker.create_labels()

if sys.argv[1] == '2':
    db.insert_student("New Test Student")

if sys.argv[1] == '3':
    db.insert_book("Test Book 3")

if sys.argv[1] == '4':
    db.update_current_user("Test Book", "Richy Truitt")

if sys.argv[1] == '5':
    db.populate_student_table()

if sys.argv[1] == '6':
    db.populate_book_table()