from wtem.models import Submission, Attachment
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
from wtem.models import Submission, Attachment
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
- users = User.objects.filter(username__in = examiner_names)
- submissions_query = Submission.objects.annotate(examiners_count = Count('examiners'))
+ users = User.objects.filter(username__in=examiner_names)
+ all_submissions = Submission.objects.annotate(examiners_count=Count('examiners'))
+
+ submissions = all_submissions.exclude(answers=None)
with_attachment_ids = Attachment.objects.values_list('submission_id', flat=True).all()
if options['attachments_only']:
with_attachment_ids = Attachment.objects.values_list('submission_id', flat=True).all()
if options['attachments_only']:
submission.examiners.add(*users)
submission.save()
self.stdout.write('added to %s:%s' % (submission.id, submission.email))
count_by_examiners = dict()
submission.examiners.add(*users)
submission.save()
self.stdout.write('added to %s:%s' % (submission.id, submission.email))
count_by_examiners = dict()
count_by_examiners[submission.examiners_count] = \
count_by_examiners.get(submission.examiners_count, 0) + 1
self.stdout.write('%s' % count_by_examiners)
count_by_examiners[submission.examiners_count] = \
count_by_examiners.get(submission.examiners_count, 0) + 1
self.stdout.write('%s' % count_by_examiners)