You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
1.2 KiB

# coding=utf-8
import os
import django
import sys
sys.path.append("/var/www/projects/lms/")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lms.settings")
django.setup()
from courses.models import Course as C
from journals.models import TeacherJ, CourseThemeJ, HomeworkJ, HomeworkTry, LessonJ, ExamTry, ExamJ
from access.models import User
s = User.objects.get(email='alvar63@mail.ru')
c = C.objects.get(id=4)
for ht in HomeworkTry.objects.filter(student__email='varavina@bk.ru', material__course=c):
ht.student = s
ht.save()
for hj in HomeworkJ.objects.filter(student__email='varavina@bk.ru', material__course=c):
hj.student = s
hj.save()
for et in ExamTry.objects.filter(student__email='varavina@bk.ru', material__course=c):
et.student = s
et.save()
for et in ExamJ.objects.filter(student__email='varavina@bk.ru', material__course=c):
et.student = s
et.save()
for et in CourseThemeJ.objects.filter(student__email='varavina@bk.ru', material__course=c):
et.student = s
et.save()
for et in LessonJ.objects.filter(student__email='varavina@bk.ru', material__course=c):
et.student = s
et.save()
tj = TeacherJ.objects.get(student__email='varavina@bk.ru', course=c)
tj.student = s
tj.save()