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.
37 lines
1.2 KiB
37 lines
1.2 KiB
# coding=utf-8
|
|
# Получить почты пользователей с темой в статусе сдано
|
|
import os
|
|
import django
|
|
import sys
|
|
BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
sys.path.append("/var/www/projects/codemy/")
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lms.settings")
|
|
django.setup()
|
|
|
|
from courses.models import Course, CourseTheme
|
|
from journals.models import CourseThemeJ
|
|
|
|
print('## Почты пользователей в статусе сдано по теме')
|
|
|
|
_courses = Course.objects.filter(public=True).order_by('id')
|
|
|
|
for _c in _courses:
|
|
print('{0}: {1}'.format(_c.id, _c.get_title()))
|
|
|
|
_c = input('Выберите курс: ')
|
|
_course = Course.objects.get(id=int(_c))
|
|
|
|
_themes = CourseTheme.objects.filter(course=_course).order_by('sort')
|
|
for _t in _themes:
|
|
print('{0}: {2}/{1}'.format(_t.id, _t.get_title(), _t.sort))
|
|
|
|
_t = input('Выберите тему: ')
|
|
_theme = CourseTheme.objects.get(id=int(_t))
|
|
|
|
_result = CourseThemeJ.objects.filter(material=_theme).exclude(date=None, f_date=None).values_list('student__email', flat=True)
|
|
|
|
for i in _result:
|
|
print(i)
|
|
|
|
print('Количество пользователей: {0}'.format(len(_result)))
|
|
|