Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 2 Next »

*class myapp.views.MyDjangoModelPermissions*

Bases: rest_framework.permissions.DjangoModelPermissions

Override DjangoModelPermissions to require view permission as well: The default allows view by anybody.

*class myapp.views.AuthnAuthzMixIn*

Bases:

Common Authn/Authz mixin for all View and ViewSet-derived classes:

``authentication_classes = (<class 'rest_framew ... OAuth2Authentication'>)``

In production Oauth2 is preferred; Allow Basic and Session for testing and browseable API.

``permission_classes = [<rest_condition.permissions.Condition object>]``

Either use Scope-based OAuth 2.0 token checking OR authenticated user w/Model Permissions.

*class myapp.views.CourseBaseViewSet(kwargs)*

Bases: myapp.views.AuthnAuthzMixIn,

Base ViewSet for all our ViewSets:

  • Adds Authn/Authz

*class myapp.views.CourseViewSet(kwargs)*

Bases: myapp.views.CourseBaseViewSet

A course of instruction. e.g. COMSW1002 Computing in Context

``serializer_class``

alias of

``search_fields = ('course_name', 'cou ... fier', 'course_number')``

Keyword searches are across these fields.

*class myapp.views.CourseTermViewSet(kwargs)*

Bases: myapp.views.CourseBaseViewSet

A specific course term (year+semester) instance. e.g. 20183COMSW1002

``serializer_class``

alias of

``search_fields = ('term_identifier',)``

Keyword searches are just this one field.

*class myapp.views.PersonViewSet(kwargs)*

Bases: myapp.views.CourseBaseViewSet

A person.

``serializer_class``

alias of

*class Meta*

Bases:

In addition to specific filters defined above, also generate some automatic filters.

``model``

alias of

*class myapp.views.InstructorFilterSet(data=None, queryset=None, *, request=None, prefix=None)*

Bases: django_filters.rest_framework.filterset.FilterSet

Extend django_filters.rest_framework.FilterSet for the Instructor model

Includes a filter “alias” for a chained search from instructor->course_term->course

``course_name = None``

filter[course_name] is an alias for the path course_terms.course.course_name

``course_name__gt = None``

filter[course_name_gt] for greater-than, etc.

``name = None``

filter[name] is an alias for the path course_terms.instructor.person.name

``name__gt = None``

filter[name_gt] for greater-than, etc.

*class Meta*

Bases:

In addition to specific filters defined above, also generate some automatic filters.

``model``

alias of

*class myapp.views.InstructorViewSet(kwargs)*

Bases: myapp.views.CourseBaseViewSet

An instructor.

``serializer_class``

alias of

``filterset_class``

alias of InstructorFilterSet

*class myapp.views.CourseRelationshipView(kwargs)*

Bases: myapp.views.AuthnAuthzMixIn,

View for courses.relationships

*class myapp.views.CourseTermRelationshipView(kwargs)*

Bases: myapp.views.AuthnAuthzMixIn,

View for course_terms.relationships

*class myapp.views.InstructorRelationshipView(kwargs)*

Bases: myapp.views.AuthnAuthzMixIn,

View for instructors.relationships

*class myapp.views.PersonRelationshipView(kwargs)*

Bases: myapp.views.AuthnAuthzMixIn,

View for people.relationships

  • No labels