evg-app-back/lessons/db_functions.py

27 lines
824 B
Python
Raw Normal View History

2021-01-10 15:51:59 +03:00
from .models import Subject, SubjectClassLocal
from organisations.models import Organisation
def extendOrganisationSubject(org, sub_name):
Subject.objects.create(name=sub_name, organisation=org)
def addSubjectToGroup(group, subName, subject):
SubjectClassLocal.objects.create(name=subName, subject=subject, group=group)
def addClassToTeacher(classLocal, teacher):
classLocal.teachers.add(teacher)
def removeTeacherFromClass(classLocal, teacher):
classLocal.teachers.remove(teacher)
def addLessonToClass(classLocal):
2021-01-20 22:10:57 +03:00
Lesson.objects.create(type_lesson=classLocal)
def addTestToLesson(lesson, deadline, name):
Tests.objects.create(name=name, deadline=deadline, lesson=lesson)
def addTaskToTest(test, theory, practise, mark):
Task.objects.create(theory=theory, practise=practise, test=test, number=mark)