def marks(): form = GetMarksForm() form.specialities.choices = [ (item.get_values()['specialityId'], item.get_values()['speciality']) for item in Dbmanager(Config.dbname).get_specialities() ] if form.validate_on_submit(): result = Dbmanager(Config.dbname).form_marks_table( form.specialities.data, form.course.data) return render_template('marks.html', title='Marks', table=result) return render_template('premarks.html', title='Marks', form=form)
def facspec(): facs = Dbmanager(Config.dbname).get_faculties() faculties = [{ "faculty": faculty, "specialities": Dbmanager(Config.dbname).get_specialities_by_faculty( faculty.get_values()['facultyId']) } for faculty in facs] return render_template('facspec.html', title='Faculties and specialities', faculties=faculties)
def Refresh(self): query = "SELECT URLs FROM URL WHERE URL.Condition='0'" use = Dbmanager() results = use.database().execute(query) self.tableWidget.setRowCount(0) for row_num, row_data in enumerate( results): #For statement creates a table for the database. self.tableWidget.insertRow(row_num) for col_num, data in enumerate(row_data): self.tableWidget.setItem(row_num, col_num, QtWidgets.QTableWidgetItem(str(data))) use.database().close()
def addfaculty(): form = AddFacultyForm() if form.validate_on_submit(): faculty = Faculty.form_values_for_db(form.data) try: Dbmanager(Config.dbname).add_faculty(faculty) except: return redirect('/error') else: return redirect('/index') return render_template('addfaculty.html', title='Add faculty', form=form)
def addsubject(): form = AddSubjectForm() if form.validate_on_submit(): subject = Subject.form_values_for_db(form.data) try: Dbmanager(Config.dbname).add_subject(subject) except: return redirect('/error') else: return redirect('/index') return render_template('addsubject.html', title='Add subject', form=form)
def addmark(): form = AddMarkForm() if form.validate_on_submit(): mark = Mark.form_values_for_db(form.data) try: Dbmanager(Config.dbname).add_mark(mark) except: return redirect('/error') else: return redirect('/index') return render_template('addmark.html', title='Add mark', form=form)
class App: def __init__(self): self.db = Dbmanager() def initApp(self): msg = '1-Öğrenci Listesi\n2-Öğrenci Ekle\n3-Öğrenci güncelle\n4-Öğrenci Sil\n5-Öğretmen Ekle\n6-Sınıflara Göre Dersler\n7-Çıkış için(Q)' while True: print(msg) islem = input('Seçim: ') if islem == '1': self.displayStudents() elif islem == '2': pass elif islem == '3': pass elif islem == '4': pass elif islem == '5': pass elif islem == '6': pass elif islem == 'Q' or 'q': break else: print('Yanlış seçim') def displayStudents(self): classes = self.db.getClasses() for i in classes: print(f'{i.id}:{i.name}') classid = input('Hangi sınıf') students = self.db.GetStudentsByClassId(classid) print('Öğrenci Listesi') for index, i in enumerate(students): print(f'{index+1}-{i.name} {i.surname}')
def insertBL( self, insert ): #Having difficulties in calling the function inputdb from db manager insert = self.inputBL.text() use = Dbmanager() use.inputdb(insert) #Inserts the suspicious website to the database.
def test_database(self): clas = Dbmanager() clas.database() self.assertTrue('connection = sqlite3.connect("urlData.db")')
def students(): students = Dbmanager(Config.dbname).get_students() return render_template('students.html', title='Students', students=students)
def index(): Dbmanager(Config.dbname).init_tables() return render_template('index.html')
def __init__(self): self.db = Dbmanager()
def test_connection(self): clas = Dbmanager() clas.graphdb() self.assertTrue('connection = sqlite3.connect("urlData.db")')
def test_connection(self): clas = Dbmanager() clas.inputdb('www.google.com') self.assertTrue('connection = sqlite3.connect("urlData.db")')
def graphicBL(self): use = Dbmanager() use.graphdb()
def subjects(): subjects = Dbmanager(Config.dbname).get_subjects() return render_template('subject.html', title='Subjects', subjects=subjects)
from dbmanager import Dbmanager if __name__ == '__main__': db = Dbmanager('test.sqlite') """db.init_tables() faculties = [ 'InPIT', 'InETS' ] specialities = [ (1, 'IFST'), (2, 'QQQQ'), (3, 'WWWW'), (4, 'DDDD') ] students = [] for i in range(1, 21): students.append((str(i), str(i) + 'ov', (i-1)%3 + 1, (i-1)%4 + 1)) for faculty in faculties: db.add_faculty(faculty) for speciality in specialities: db.add_speciality(speciality) for student in students: db.add_student(student)
def __init__(self): super().__init__() self.urlData = pd.read_sql_query("SELECT * FROM Url", Dbmanager.database(self))