Courses App

The courses app deals with the accesing course information, the sharing of courses, and the rendering of the course/all course pages.

Views

class courses.views.CourseDetail(**kwargs)[source]

View that handles individual course entities.

get(request, sem_name, year, course_id)[source]

Return detailed data about a single course. Currently used for course modals.

class courses.views.CourseModal(**kwargs)[source]

A FeatureFlowView for loading a course share link which directly opens the course modal on the frontend. Therefore, this view overrides the get_feature_flow method to fill intData with the detailed course json for the modal.abs

Saves a SharedCourseView for analytics purposes.

courses.views.all_courses(request, *args, **kwargs)[source]

Generates the full course directory page. Includes links to all courses and is sorted by department.

courses.views.course_page(request, *args, **kwargs)[source]

Generates a static course page for the provided course code and school (via subdomain). Completely outside of the React framework purely via Django templates.

courses.views.get_classmates_in_course(request, school, sem_name, year, course_id)[source]

Finds all classmates for the authenticated user who also have a timetable with the given course.

Utils

courses.utils.get_sections_by_section_type(course, semester)[source]

Return a map from section type to Sections for a given course and semester.

courses.utils.sections_are_filled(sections)[source]

Return True if all sections are filled beyond their max enrollment.

Serializers

class courses.serializers.CourseSerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]

Serialize a Course into a dictionary with detailed information about the course, and all related entities (eg Sections). Used for search results and course modals. Takes a context with parameters: school: str (required) semester: Semester (required) student: Student (optional)

get_evals(course)[source]

Flag all eval instances s.t. there exists repeated term+year values. :returns: List of modified evaluation dictionaries (added flag ‘unique_term_year’)

get_popularity_percent(course)[source]

Return percentage of course capacity that is filled by registered students.

get_regexed_courses(course)[source]

Given course data, search for all occurrences of a course code in the course description and prereq info and return a map from course code to course name for each course code.

courses.serializers.get_section_dict(section)[source]

Returns a dictionary of a section including indicator of whether that section is filled