How to use the devilry.apps.core.models.AssignmentGroup.objects function in devilry

To help you get started, we’ve selected a few devilry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github devilry / devilry-django / devilry / devilry_examiner / views / assignment / grouplist.py View on Github external
.order_by(
                Lower(Concat('relatedstudent__user__fullname',
                             'relatedstudent__user__shortname')))
        examinerqueryset = Examiner.objects\
            .select_related('relatedexaminer__user')\
            .only(
                'relatedexaminer',
                'assignmentgroup',
                'relatedexaminer__automatic_anonymous_id',
                'relatedexaminer__user__shortname',
                'relatedexaminer__user__fullname',
            )\
            .order_by(
                Lower(Concat('relatedexaminer__user__fullname',
                             'relatedexaminer__user__shortname')))
        queryset = coremodels.AssignmentGroup.objects\
            .filter_examiner_has_access(user=self.request.user)\
            .filter(parentnode=assignment)\
            .prefetch_related(
                models.Prefetch('candidates',
                                queryset=candidatequeryset))\
            .prefetch_related(
                models.Prefetch('examiners',
                                queryset=examinerqueryset)) \
            .annotate_with_is_waiting_for_feedback_count()\
            .annotate_with_is_waiting_for_deliveries_count()\
            .annotate_with_is_corrected_count() \
            .annotate_with_number_of_private_groupcomments_from_user(user=self.request.user) \
            .annotate_with_number_of_private_imageannotationcomments_from_user(user=self.request.user)\
            .distinct()\
            .select_related('cached_data__last_published_feedbackset',
                            'cached_data__last_feedbackset',
github devilry / devilry-django / devilry / devilry_api / group_comment / views / groupcomment_student.py View on Github external
def get_role_query_set(self):
        """
        Returns role queryset for student role

        Returns:
            :class:`~devilry_group.GroupComment` queryset
        """
        assignment_group_queryset = AssignmentGroup.objects.filter_student_has_access(user=self.request.user)
        return GroupComment.objects.filter(feedback_set__group__in=assignment_group_queryset,
                                           comment_type=GroupComment.COMMENT_TYPE_GROUPCOMMENT,
                                           visibility=GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE)\
            .select_related('feedback_set__group__parentnode', 'user')
github devilry / devilry-django / src / devilry_examiner / devilry_examiner / views / singlegroupoverview.py View on Github external
def get_queryset(self):
        return AssignmentGroup.objects.filter_examiner_has_access(self.request.user)
github devilry / devilry-django / devilry / devilry_student / views / groupdetails.py View on Github external
def _get_group(self):
        try:
            return AssignmentGroup.objects\
                    .filter_student_has_access(self.request.user)\
                    .select_related(
                        'last_deadline',
                        'parentnode', # Assignment
                        'parentnode__parentnode', # Period
                        'parentnode__parentnode__parentnode', # Subject
                    )\
                    .get(id=self.kwargs['id'])
        except AssignmentGroup.DoesNotExist:
            raise Http404()
github devilry / devilry-django / devilry / devilry_examiner / views / singlegroupoverview.py View on Github external
def get_queryset(self):
        return AssignmentGroup.objects.filter_examiner_has_access(self.request.user)
github devilry / devilry-django / devilry / devilry_admin / views / assignment / students / groupdetails.py View on Github external
def get_queryset_for_role(self, role):
        assignment = role
        candidatequeryset = Candidate.objects\
            .select_related('relatedstudent__user')\
            .order_by(
                Lower(Concat('relatedstudent__user__fullname',
                             'relatedstudent__user__shortname')))
        examinerqueryset = Examiner.objects\
            .select_related('relatedexaminer__user')\
            .order_by(
                Lower(Concat('relatedexaminer__user__fullname',
                             'relatedexaminer__user__shortname')))
        return AssignmentGroup.objects\
            .filter(parentnode=assignment)\
            .prefetch_related(
                models.Prefetch('candidates',
                                queryset=candidatequeryset))\
            .prefetch_related(
                models.Prefetch('examiners',
                                queryset=examinerqueryset))\
            .annotate_with_is_waiting_for_feedback_count()\
            .annotate_with_is_waiting_for_deliveries_count()\
            .annotate_with_is_corrected_count() \
            .annotate_with_number_of_private_groupcomments_from_user(user=self.request.user) \
            .annotate_with_number_of_private_imageannotationcomments_from_user(user=self.request.user)\
            .distinct() \
            .select_related('cached_data__last_published_feedbackset',
                            'cached_data__last_feedbackset',
                            'cached_data__first_feedbackset',
github devilry / devilry-django / devilry / devilry_import_v2database / modelimporters / delivery_feedback_importers.py View on Github external
def _user_is_candidate_in_group(self, assignment_group, user):
        group_queryset = AssignmentGroup.objects.filter(id=assignment_group.id).filter_user_is_candidate(user=user)
        if group_queryset.count() == 0:
            return False
        return True
github devilry / devilry-django / devilry / devilry_admin / views / assignment / overview.py View on Github external
def get_assignment_groups_without_any_examiners(self):
        return AssignmentGroup.objects.filter(parentnode=self.request.cradmin_role, examiners__isnull=True)
github devilry / devilry-django / devilry / devilry_student / views / group / projectgroupapp.py View on Github external
def get_queryset(self):
        return AssignmentGroup.objects.filter_student_has_access(self.request.user) \
            .select_related(
            'parentnode',  # Assignment
            'parentnode__parentnode',  # Period
            'parentnode__parentnode__parentnode')  # Subject