Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
    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()
Ejemplo n.º 7
0
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)
Ejemplo n.º 8
0
 def graphicBL(self):
     use = Dbmanager()
     use.graphdb()
Ejemplo n.º 9
0
 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.
Ejemplo n.º 10
0
def subjects():
    subjects = Dbmanager(Config.dbname).get_subjects()
    return render_template('subject.html', title='Subjects', subjects=subjects)
Ejemplo n.º 11
0
def students():
    students = Dbmanager(Config.dbname).get_students()
    return render_template('students.html',
                           title='Students',
                           students=students)
Ejemplo n.º 12
0
def index():
    Dbmanager(Config.dbname).init_tables()
    return render_template('index.html')
Ejemplo n.º 13
0
 def __init__(self):
     self.db = Dbmanager()
Ejemplo n.º 14
0
 def test_connection(self):
     clas = Dbmanager()
     clas.graphdb()
     self.assertTrue('connection = sqlite3.connect("urlData.db")')
Ejemplo n.º 15
0
 def test_connection(self):
     clas = Dbmanager()
     clas.inputdb('www.google.com')
     self.assertTrue('connection = sqlite3.connect("urlData.db")')
Ejemplo n.º 16
0
 def test_database(self):
     clas = Dbmanager()
     clas.database()
     self.assertTrue('connection = sqlite3.connect("urlData.db")')