def edit_card(self): edit_id = int( input( 'Please enter the ID for the card that you want to update: ')) edit_card_details = Db_connection() result = edit_card_details.display_card_db(edit_id) print(f"1: Card ID: {result[0]}") print(f"2: Subject: {result[1]}") print(f"3: Question: {result[2]}") print(f"4: Answer: {result[3]}") print(f"5: Addional Info: {result[4]}")
def create_card(self): entry = [] print("Create flashcard: ") subject = input('Please enter main subject: ') category = input('Please enter catagory: ') question = input('Plese enter the flashcard Question: ') answer = input('Please enter the Answer: ') add_info = input('Please add any additional info: ') entry = (subject, category, question, answer, add_info) create_card_entry = Db_connection() create_card_entry.create_card_db(entry)
def display_subject_list(self, column, cat=''): pass listing = [] display_subject_db = Db_connection() if cat == '': trup_list = display_subject_db.display_subject_list_db(column) else: trup_list = display_subject_db.display_subject_list_db(column, cat) for t in trup_list: for i in t: listing.append(i) return listing #testcard = Cards() #testcard.edit_card() #testcard.create_card() #testcard.delete_card() #testcard.edit_card() #testcard.display_cards() #testcard.display_subject_list()
from flask import Flask, render_template as render, redirect, request, session, flash, jsonify from db_connection import Db_connection from datetime import datetime app = Flask(__name__) app.secret_key = "wqeelkmdsnbnuizapajvdpoji" app.name = "bracket" db = Db_connection(app) @app.route("/") def leaderboard(): if "user_id" in session: user = db.getUser(session["user_id"])[0] else: user = None return render("leaderboard.html", users=db.getUsers(), user=user) @app.route("/sign_up") def signUp(): return render("signUp.html") @app.route("/register", methods=["POST"]) def register(): u = db.register(request.form) if isinstance(u, list): for error in u: flash(error) return redirect("/sign_up")
def get_collection(self, cgrouping): collection = [] card_collection = Db_connection() collection_order = card_collection.retrieve_subject_cards_db(cgrouping) random.shuffle(collection_order) return collection_order
def display_cards(self): pass display_cards_db = Db_connection() return display_cards_db.retrieve_card_list_db()
def delete_card(self): delete_id = int( input( 'Please enter the ID # for the card you would like deleted: ')) delete_card_details = Db_connection() delete_card_details.del_card_db(delete_id)