Example #1
0
class SimplifiedFileMetaMetaMixin(object):
    """ Defines the django model to be used, resultfields returned by
    search and which fields can be used to search for a FileMeta object
    using the Simplified API """
    model = models.FileMeta
    resultfields = FieldSpec('filename',
                             'size',
                             'id',
                             'delivery',
                             subject=['delivery__deadline__assignment_group__parentnode__parentnode__parentnode__id',
                                      'delivery__deadline__assignment_group__parentnode__parentnode__parentnode__short_name',
                                      'delivery__deadline__assignment_group__parentnode__parentnode__parentnode__long_name'],
                             period=['delivery__deadline__assignment_group__parentnode__parentnode__id',
                                     'delivery__deadline__assignment_group__parentnode__parentnode__short_name',
                                     'delivery__deadline__assignment_group__parentnode__parentnode__long_name'],
                             assignment=['delivery__deadline__assignment_group__parentnode__id',
                                         'delivery__deadline__assignment_group__parentnode__short_name',
                                         'delivery__deadline__assignment_group__parentnode__long_name'])
    searchfields = FieldSpec(
        'delivery__deadline__assignment_group__candidates__identifier',  # student in assignment_group
        'delivery__deadline__assignment_group__parentnode__parentnode__parentnode__short_name',  # subject
        'delivery__deadline__assignment_group__parentnode__parentnode__parentnode__long_name',  # subject
        'delivery__deadline__assignment_group__parentnode__parentnode__short_name',  # period
        'delivery__deadline__assignment_group__parentnode__parentnode__long_name',  # period
        'delivery__deadline__assignment_group__parentnode__short_name',  # assignment
        'delivery__deadline__assignment_group__parentnode__long_name',  # assignment
        )

    filters = FilterSpecs(FilterSpec('id'),
                          FilterSpec('filename'),
                          FilterSpec('size'),
                          FilterSpec('delivery'))
Example #2
0
class SimplifiedAbstractApplicationKeyValueMixin(object):
    resultfields = FieldSpec('id', 'application', 'key', 'value')
    searchfields = FieldSpec('application', 'key', 'value')
    editablefields = ('application', 'key', 'value')
    filters = FilterSpecs(
        FilterSpec('id', supported_comp=('exact', )),
        FilterSpec('application', supported_comp=('exact', )),
        FilterSpec('key', supported_comp=('exact', )))
Example #3
0
class SimplifiedStaticFeedbackMetaMixin(object):
    """ Defines the django model to be used, resultfields returned by
    search and which fields can be used to search for a StaticFeedback object
    using the Simplified API """
    model = models.StaticFeedback
    resultfields = FieldSpec(
        'id',
        'grade',
        'is_passing_grade',
        'saved_by',
        'save_timestamp',
        'delivery',
        'rendered_view',
        candidates=[
            'delivery__deadline__assignment_group__candidates__identifier'
        ],
        period=[
            'delivery__deadline__assignment_group__parentnode__parentnode__id',
            'delivery__deadline__assignment_group__parentnode__parentnode__short_name',
            'delivery__deadline__assignment_group__parentnode__parentnode__long_name'
        ],
        subject=[
            'delivery__deadline__assignment_group__parentnode__parentnode__parentnode__id',
            'delivery__deadline__assignment_group__parentnode__parentnode__parentnode__short_name',
            'delivery__deadline__assignment_group__parentnode__parentnode__parentnode__long_name'
        ],
        assignment=[
            'delivery__deadline__assignment_group__parentnode__id',
            'delivery__deadline__assignment_group__parentnode__short_name',
            'delivery__deadline__assignment_group__parentnode__long_name'
        ],
        assignment_group=[
            'delivery__deadline__assignment_group',
            'delivery__deadline__assignment_group__name'
        ],
        delivery=[
            'delivery__time_of_delivery', 'delivery__number',
            'delivery__delivered_by'
        ])
    searchfields = FieldSpec(
        'delivery__deadline__assignment_group__parentnode__parentnode__parentnode__short_name',
        'delivery__deadline__assignment_group__parentnode__parentnode__parentnode__long_name',
        'delivery__deadline__assignment_group__parentnode__parentnode__short_name',
        'delivery__deadline__assignment_group__parentnode__parentnode__long_name',
        'delivery__deadline__assignment_group__parentnode__short_name',
        'delivery__deadline__assignment_group__parentnode__long_name',
        'delivery__number')
    filters = FilterSpecs(
        FilterSpec('id'),
        FilterSpec('delivery'),
        ForeignFilterSpec(
            'delivery__deadline__assignment_group__parentnode__parentnode',  # Period
            FilterSpec('start_time'),
            FilterSpec('end_time')),
    )
class RelatedUsersMetaBase:
    methods = ['create', 'read', 'update', 'delete', 'search']
    resultfields = FieldSpec('id', 'period', 'user', 'tags', 'user__username',
                             'user__devilryuserprofile__full_name',
                             'user__email')
    searchfields = FieldSpec('user__username',
                             'user__devilryuserprofile__full_name')
    editablefields = ('period', 'user')
    filters = FilterSpecs(FilterSpec('id', supported_comp=('exact', )),
                          FilterSpec('period', supported_comp=('exact', )),
                          FilterSpec('user', supported_comp=('exact', )))
Example #5
0
 class Meta(SimplifiedAbstractApplicationKeyValueMixin):
     model = models.PeriodApplicationKeyValue
     methods = ['create', 'read', 'update', 'delete', 'search']
     resultfields = FieldSpec(
         'period') + SimplifiedAbstractApplicationKeyValueMixin.resultfields
     editablefields = (
         'period',
     ) + SimplifiedAbstractApplicationKeyValueMixin.editablefields
     filters = FilterSpecs(
         FilterSpec('period', supported_comp=('exact', )),
         FilterSpec('period__start_time'), FilterSpec('period__end_time'),
         FilterSpec('period__parentnode', supported_comp=('exact', )),
         FilterSpec('period__parentnode__parentnode',
                    supported_comp=('exact', ))
     ) + SimplifiedAbstractApplicationKeyValueMixin.filters
Example #6
0
class SimplifiedExaminerMetaMixin(object):
    """ Defines the django model to be used, resultfields returned by
    search and which fields can be used to search for a Examiner object
    using the Simplified API """
    model = models.Examiner
    resultfields = FieldSpec('id', 'assignmentgroup')
    searchfields = FieldSpec()
    filters = FilterSpecs(
        FilterSpec('id'),
        FilterSpec('assignmentgroup'),
        FilterSpec('assignmentgroup__parentnode'),  # Assignment
        FilterSpec('assignmentgroup__parentnode__parentnode'),  # Period
        FilterSpec(
            'assignmentgroup__parentnode__parentnode__parentnode')  # Subject
    )
Example #7
0
class SimplifiedCandidateMetaMixin(object):
    """ Defines the django model to be used, resultfields returned by
    search and which fields can be used to search for a Candidate object
    using the Simplified API """
    model = models.Candidate
    resultfields = FieldSpec('id', 'identifier', 'full_name', 'email',
                             'assignment_group')
    searchfields = FieldSpec('identifier')
    filters = FilterSpecs(
        FilterSpec('id'),
        FilterSpec('assignment_group'),
        FilterSpec('assignment_group__parentnode'),  # Assignment
        FilterSpec('assignment_group__parentnode__parentnode'),  # Period
        FilterSpec(
            'assignment_group__parentnode__parentnode__parentnode')  # Subject
    )
Example #8
0
 class Meta():
     model = models.Node
     resultfields = FieldSpec('id',
                              'parentnode',
                              'short_name',
                              'long_name',
                              admins=['admins__username'])
     searchfields = FieldSpec('short_name',
                              'long_name')
     filters = FilterSpecs(FilterSpec('parentnode'),
                           FilterSpec('short_name'),
                           FilterSpec('long_name'),
                           PatternFilterSpec('^(parentnode__)+short_name$'),
                           PatternFilterSpec('^(parentnode__)+long_name$'),
                           PatternFilterSpec('^(parentnode__)+id$'))
     methods = ['create', 'read', 'update', 'delete', 'search']
Example #9
0
 class Meta(RelatedUsersMetaBase):
     """ Defines what methods an Administrator can use on a RelatedStudent object using the Simplified API """
     model = models.RelatedStudent
     resultfields = RelatedUsersMetaBase.resultfields + FieldSpec('candidate_id')
     searchfields = RelatedUsersMetaBase.searchfields + FieldSpec('candidate_id')
     editablefields = RelatedUsersMetaBase.editablefields + ('candidate_id',)
     filters = RelatedUsersMetaBase.filters + FilterSpecs(FilterSpec('candidate_id'))
Example #10
0
 class Meta(SimplifiedAssignmentGroupMetaMixin):
     """ Defines what methods an Administrator can use on an AssignmentGroup object using the Simplified API """
     editablefields = ('id', 'name', 'is_open', 'parentnode')
     fake_editablefields = ('fake_examiners', 'fake_candidates', 'fake_tags')
     methods = ['create', 'read', 'update', 'delete', 'search']
     resultfields = \
             FieldSpec(users=['candidates__student__username', 'candidates__identifier', 'examiners__user__username'],
                       students_full_name=['candidates__student__devilryuserprofile__full_name'],
                       tags=['tags__tag']) + \
             SimplifiedAssignmentGroupMetaMixin.resultfields
     searchfields = FieldSpec('tags__tag',
                              'candidates__student__username',
                              'examiners__user__username',
                              'candidates__student__devilryuserprofile__full_name') + SimplifiedAssignmentGroupMetaMixin.searchfields
     filters = SimplifiedAssignmentGroupMetaMixin.filters + \
             FilterSpecs(FilterSpec('candidates__student__username', type_converter=stringOrNoneConverter),
                         FilterSpec('examiners__user__username', type_converter=stringOrNoneConverter),
                         FilterSpec('tags__tag', type_converter=stringOrNoneConverter))
Example #11
0
 class Meta:
     model = FeedbackDraft
     resultfields = FieldSpec('id', 'delivery', 'saved_by',
                              'save_timestamp', 'draft', 'published',
                              'staticfeedback')
     searchfields = FieldSpec()
     filters = FilterSpecs(FilterSpec('delivery'))
     methods = ('create', 'read', 'search')
     editablefields = ('delivery', 'draft', 'published')
Example #12
0
 class Meta(SimplifiedPeriodMetaMixin):
     model = Period
     methods = ['create', 'read', 'update', 'delete', 'search']
     resultfields = FieldSpec(
         'id',
         'parentnode',
         'short_name',
         'long_name',
         'start_time',
         'end_time',
         'group',
         'period_ptr',
         subject=['parentnode__short_name', 'parentnode__long_name'])
     searchfields = FieldSpec('short_name', 'long_name',
                              'parentnode__short_name',
                              'parentnode__long_name')
     filters = FilterSpecs(
         FilterSpec('short_name'),
         FilterSpec('group', type_converter=intOrNoneConverter))
 class Meta(object):
     model = PeriodExercise
     resultfields = FieldSpec('id',
                              'period',
                              'exercise',
                              'points',
                              'starred',
                              'number',
                              exercise=['exercise__short_name',
                                        'exercise__long_name',
                                        'exercise__topics__name'],
                              period=['period__long_name', 'period__short_name']
                              )
     searchfields = FieldSpec('period__short_name',
                              'period__long_name',
                              'exercise__short_name',
                              'exercise__long_name',
                              'exercise__topics__name')
     filters = FilterSpecs(FilterSpec('exercise'), FilterSpec('period'))
     methods = ['create', 'read', 'update', 'delete', 'search']
Example #14
0
    class Meta(HasAdminsMixin.MetaMixin):
        """ Defines the CRUD+S methods, the django model to be used, resultfields returned by
        search and which fields can be used to search for a Node object
        using the Simplified API """

        fake_editablefields = ('fake_admins', )
        methods = ['create', 'read', 'update', 'delete', 'search']

        model = models.Node
        resultfields = FieldSpec('id',
                                 'parentnode',
                                 'short_name',
                                 'long_name',
                                 admins=['admins__username'])
        searchfields = FieldSpec('short_name', 'long_name')
        filters = FilterSpecs(FilterSpec('parentnode'),
                              FilterSpec('short_name'),
                              FilterSpec('long_name'),
                              PatternFilterSpec('^(parentnode__)+short_name$'),
                              PatternFilterSpec('^(parentnode__)+long_name$'),
                              PatternFilterSpec('^(parentnode__)+id$'))
Example #15
0
    class Meta(object):
        model = Exercise
        searchfields = FieldSpec('short_name', 'long_name', 'topics__name')
        resultfields = FieldSpec('id', 'short_name', 'long_name', 'text', 'points',
                                 'topics__id', 'prerequisites__id',
                                 topics=['topics__name'], prerequisites=['prerequisites__name'])

#       editablefields = ('id', 'short_name', 'long_name', 'text', 'points')
        fake_editablefields = ('fake_topics', 'fake_prerequisites')
        fake_real_map =  {'fake_topics': ('topics', Topic, 'pk', 'name'),
                          'fake_prerequisites': ('prerequisites', Topic, 'pk', 'name')}
        filters = FilterSpecs(FilterSpec('topics__id'))
        methods = ['create', 'read', 'update', 'delete', 'search']
Example #16
0
 class Meta(object):
     model = PeriodGroup
     methods = ['create', 'read', 'update', 'delete', 'search']
     searchfields = FieldSpec('long_name', 'subject__long_name',
                              'periods__long_name')
     resultfields = FieldSpec(
         'id',
         'long_name',
         'subject',
         'subject__long_name',
         'periods__id',
         periods=['periods__short_name', 'periods__long_name'])
     fake_editablefields = ('fake_periods', 'fake_followers',
                            'fake_students')
     fake_real_map = {'fake_periods': ('periods', Period)}
     filters = FilterSpecs(FilterSpec('followers__id'))
 class Meta(HasAdminsMixin.MetaMixin):
     """ Defines what methods an Administrator can use on an AssignmentGroupTag object using the Simplified API """
     model = AssignmentGroupTag
     methods = ('create', 'read', 'update', 'delete', 'search')
     editablefields = ('tag', 'assignment_group')
     resultfields = FieldSpec('id', 'assignment_group', 'tag')
     searchfields = FieldSpec()
     filters = FilterSpecs(
         FilterSpec('id'),
         FilterSpec('tag'),
         FilterSpec('assignment_group'),
         FilterSpec('assignment_group__parentnode'),  # Assignment
         FilterSpec('assignment_group__parentnode__parentnode'),  # Period
         FilterSpec('assignment_group__parentnode__parentnode__parentnode'
                    )  # Subject
     )
Example #18
0
class SimplifiedSubjectMetaMixin(object):
    """ Defines the django model to be used, resultfields returned by
    search and which fields can be used to search for a Subject object
    using the Simplified API """
    model = models.Subject
    resultfields = FieldSpec(
        'id',
        'parentnode',
        'short_name',
        'long_name',
    )
    searchfields = FieldSpec('short_name', 'long_name')
    filters = FilterSpecs(
        FilterSpec('parentnode'),
        FilterSpec('short_name'),
        FilterSpec('long_name'),
        ForeignFilterSpec(
            'parentnode',  # Node
            FilterSpec('parentnode'),
            FilterSpec('short_name'),
            FilterSpec('long_name')))
Example #19
0
class SimplifiedDeadlineMetaMixin(object):
    """ Defines the django model to be used, resultfields returned by
    search and which fields can be used to search for a Deadline object
    using the Simplified API """
    model = models.Deadline
    annotated_fields = ('number_of_deliveries',)
    resultfields = FieldSpec('id',
                             'text',
                             'deadline',
                             'assignment_group',
                             'number_of_deliveries',
                             'feedbacks_published',
                             subject=['assignment_group__parentnode__parentnode__parentnode__id',
                                      'assignment_group__parentnode__parentnode__parentnode__short_name',
                                      'assignment_group__parentnode__parentnode__parentnode__long_name'],
                             period=['assignment_group__parentnode__parentnode__id',
                                     'assignment_group__parentnode__parentnode__short_name',
                                     'assignment_group__parentnode__parentnode__long_name'],
                             assignment=['assignment_group__parentnode__id',
                                         'assignment_group__parentnode__delivery_types',
                                         'assignment_group__parentnode__short_name',
                                         'assignment_group__parentnode__long_name'],
                             assignment_group=['assignment_group__name', 'assignment_group__is_open'],
                             assignment_group_users=['assignment_group__candidates__identifier']
                             )
    searchfields = FieldSpec(
        'assignment_group__candidates__identifier',
        'assignment_group__parentnode__short_name',  # Name of assignment
        'assignment_group__parentnode__long_name',  # Name of assignment
        'assignment_group__parentnode__parentnode__short_name',  # Name of period
        'assignment_group__parentnode__parentnode__long_name',  # Name of period
        'assignment_group__parentnode__parentnode__parentnode__short_name',  # Name of subject
        'assignment_group__parentnode__parentnode__parentnode__long_name'  # Name of subject
        )
    filters = FilterSpecs(FilterSpec('id'),
                          FilterSpec('deadline'),
                          FilterSpec('assignment_group'),
                          FilterSpec('number_of_deliveries'),
                          ForeignFilterSpec('assignment_group',  # Assignment
                                            FilterSpec('is_open'),
                                            FilterSpec('name')),
                          ForeignFilterSpec('assignment_group__parentnode',  # Assignment
                                            FilterSpec('delivery_types'),
                                            FilterSpec('parentnode'),
                                            FilterSpec('short_name'),
                                            FilterSpec('long_name')),
                          ForeignFilterSpec('assignment_group__parentnode__parentnode',  # Period
                                            FilterSpec('parentnode'),
                                            FilterSpec('short_name'),
                                            FilterSpec('long_name')),
                          ForeignFilterSpec('assignment_group__parentnode__parentnode__parentnode',  # Subject
                                            FilterSpec('parentnode'),
                                            FilterSpec('short_name'),
                                            FilterSpec('long_name')))
Example #20
0
class SimplifiedDeliveryMetaMixin(object):
    """ Defines the django model to be used, resultfields returned by
    search and which fields can be used to search for a Delivery object
    using the Simplified API """
    model = models.Delivery
    editablefields = ('deadline', 'successful')
    resultfields = FieldSpec(
        'id',
        'number',
        'time_of_delivery',
        'deadline',
        'successful',
        'delivery_type',
        'alias_delivery',
        delivered_by=['delivered_by__identifier'],
        candidates=['deadline__assignment_group__candidates__identifier'],
        deadline=['deadline__deadline'],
        assignment_group=[
            'deadline__assignment_group', 'deadline__assignment_group__name'
        ],
        assignment_group_users=[
            'deadline__assignment_group__candidates__identifier'
        ],
        assignment=[
            'deadline__assignment_group__parentnode',
            'deadline__assignment_group__parentnode__delivery_types',
            'deadline__assignment_group__parentnode__short_name',
            'deadline__assignment_group__parentnode__long_name'
        ],
        period=[
            'deadline__assignment_group__parentnode__parentnode',
            'deadline__assignment_group__parentnode__parentnode__start_time',
            'deadline__assignment_group__parentnode__parentnode__end_time',
            'deadline__assignment_group__parentnode__parentnode__short_name',
            'deadline__assignment_group__parentnode__parentnode__long_name'
        ],
        subject=[
            'deadline__assignment_group__parentnode__parentnode__parentnode',
            'deadline__assignment_group__parentnode__parentnode__parentnode__short_name',
            'deadline__assignment_group__parentnode__parentnode__parentnode__long_name'
        ])
    searchfields = FieldSpec(
        'number',
        # assignmentgroup
        'deadline__assignment_group__name',
        'deadline__assignment_group__candidates__identifier',
        # assignment
        'deadline__assignment_group__parentnode__short_name',
        'deadline__assignment_group__parentnode__long_name',
        # period
        'deadline__assignment_group__parentnode__parentnode__short_name',
        'deadline__assignment_group__parentnode__parentnode__long_name',
        # subject
        'deadline__assignment_group__parentnode__parentnode__parentnode__short_name',
        'deadline__assignment_group__parentnode__parentnode__parentnode__long_name'
    )
    filters = FilterSpecs(
        FilterSpec('id'),
        FilterSpec('deadline'),
        FilterSpec('delivery_type'),
        FilterSpec('time_of_delivery'),
        ForeignFilterSpec('deadline', FilterSpec('deadline'),
                          FilterSpec('assignment_group')),
        ForeignFilterSpec(
            'deadline__assignment_group',  # AssignmentGroup
            FilterSpec('parentnode'),
            FilterSpec('name')),
        ForeignFilterSpec(
            'deadline__assignment_group__parentnode',  # Assignment
            FilterSpec('parentnode'),
            FilterSpec('delivery_types'),
            FilterSpec('short_name'),
            FilterSpec('long_name')),
        ForeignFilterSpec(
            'deadline__assignment_group__parentnode__parentnode',  # Period
            FilterSpec('parentnode'),
            FilterSpec('start_time'),
            FilterSpec('end_time'),
            FilterSpec('short_name'),
            FilterSpec('long_name')),
        ForeignFilterSpec(
            'deadline__assignment_group__parentnode__parentnode__parentnode',  # Subject
            FilterSpec('parentnode'),
            FilterSpec('short_name'),
            FilterSpec('long_name')))
Example #21
0
class SimplifiedAssignmentGroupMetaMixin(object):
    """ Defines the django model to be used, resultfields returned by
    search and which fields can be used to search for an AssignmentGroup object
    using the Simplified API """
    model = models.AssignmentGroup
    annotated_fields = ('latest_delivery_id', 'number_of_deliveries', 'latest_deadline_deadline', 'latest_deadline_id')
    resultfields = FieldSpec('id',
                             'name',
                             'is_open',
                             'parentnode',
                             'feedback',
                             'latest_delivery_id',
                             'latest_deadline_id',
                             'latest_deadline_deadline',
                             'number_of_deliveries',
                             candidates=[OneToMany('candidates', fields=['identifier', 'full_name', 'email'])],
                             feedback=['feedback__points',
                                       'feedback__grade',
                                       'feedback__is_passing_grade'],
                             feedback_rendered_view=['feedback__rendered_view'],
                             feedbackdelivery=['feedback__delivery__number',
                                               'feedback__delivery__time_of_delivery',
                                               'feedback__delivery__delivery_type',
                                               'feedback__delivery__deadline'],
                             assignment=['parentnode__long_name',
                                         'parentnode__short_name',
                                         'parentnode__anonymous',
                                         'parentnode__delivery_types',
                                         'parentnode__publishing_time'],
                             period=['parentnode__parentnode',
                                     'parentnode__parentnode__long_name',
                                     'parentnode__parentnode__short_name'],
                             subject=['parentnode__parentnode__parentnode',
                                      'parentnode__parentnode__parentnode__long_name',
                                      'parentnode__parentnode__parentnode__short_name']
                             )
    orderbyfields = ['candidates__identifier', 'candidates__full_name', 'candidates__email']
    searchfields = FieldSpec('name',
                             'candidates__identifier',
                             'candidates__full_name',
                             'candidates__email',
                             # assignment
                             'parentnode__long_name',
                             'parentnode__short_name',
                             # period
                             'parentnode__parentnode__long_name',
                             'parentnode__parentnode__short_name',
                             # subject
                             'parentnode__parentnode__parentnode__long_name',
                             'parentnode__parentnode__parentnode__short_name',
                             )
    filters = FilterSpecs(FilterSpec('id'),
                          FilterSpec('parentnode'),
                          FilterSpec('is_open', type_converter=boolConverter),
                          FilterSpec('latest_deadline_deadline', type_converter=dateTimeConverter),
                          FilterSpec('number_of_deliveries', type_converter=intConverter),

                          # Feedback
                          FilterSpec('feedback', type_converter=intOrNoneConverter),
                          FilterSpec('feedback__points', type_converter=intConverter),
                          FilterSpec('feedback__is_passing_grade', type_converter=boolConverter),
                          FilterSpec('feedback__grade'),

                          FilterSpec('candidates__identifier', type_converter=noCandidateIdConverter),

                          # Latest delivery
                          FilterSpec('feedback__delivery__number', type_converter=intConverter),
                          FilterSpec('feedback__delivery__time_of_delivery', type_converter=dateTimeConverter),
                          FilterSpec('feedback__delivery__delivery_type', type_converter=intConverter),

                          ForeignFilterSpec('parentnode',  # Assignment
                                            FilterSpec('delivery_types'),
                                            FilterSpec('parentnode'),
                                            FilterSpec('short_name'),
                                            FilterSpec('long_name')),
                          ForeignFilterSpec('parentnode__parentnode',  # Period
                                            FilterSpec('parentnode'),
                                            FilterSpec('start_time'),
                                            FilterSpec('end_time'),
                                            FilterSpec('short_name'),
                                            FilterSpec('long_name')),
                          ForeignFilterSpec('parentnode__parentnode__parentnode',  # Subject
                                            FilterSpec('parentnode'),
                                            FilterSpec('short_name'),
                                            FilterSpec('long_name')))
Example #22
0
class SimplifiedAssignmentMetaMixin(object):
    """ Defines the django model to be used, resultfields returned by
    search and which fields can be used to search for an Assignment object
    using the Simplified API """
    model = models.Assignment
    resultfields = FieldSpec('id',
                             'parentnode',
                             'short_name',
                             'long_name',
                             'publishing_time',
                             'delivery_types',
                             'anonymous',
                             'scale_points_percent',
                             period=[
                                 'parentnode__short_name',
                                 'parentnode__long_name',
                                 'parentnode__start_time',
                                 'parentnode__end_time',
                                 'parentnode__parentnode'
                             ],
                             subject=[
                                 'parentnode__parentnode__short_name',
                                 'parentnode__parentnode__long_name'
                             ])
    searchfields = FieldSpec('short_name', 'long_name',
                             'parentnode__short_name', 'parentnode__long_name',
                             'parentnode__parentnode__short_name',
                             'parentnode__parentnode__long_name')
    filters = FilterSpecs(
        FilterSpec('parentnode'),
        FilterSpec('short_name'),
        FilterSpec('long_name'),
        FilterSpec('delivery_types'),
        FilterSpec('anonymous'),
        # Period
        ForeignFilterSpec('parentnode', FilterSpec('parentnode'),
                          FilterSpec('start_time'), FilterSpec('end_time'),
                          FilterSpec('short_name'), FilterSpec('long_name')),
        # Subject
        ForeignFilterSpec('parentnode__parentnode', FilterSpec('parentnode'),
                          FilterSpec('short_name'), FilterSpec('long_name')))
 class Meta:
     model = models.RelatedStudentKeyValue
     methods = ['read', 'search']
     resultfields = FieldSpec('relatedstudent', 'relatedstudent__period') + SimplifiedAbstractApplicationKeyValueMixin.resultfields
     searchfields = SimplifiedAbstractApplicationKeyValueMixin.searchfields
     filters = FilterSpecs(FilterSpec('relatedstudent__period', supported_comp=('exact',))) + SimplifiedAbstractApplicationKeyValueMixin.filters