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.

get_feature_flow(request, code, sem_name, year)[source]

Return data needed for the feature flow for this HomeView. A name value is automatically added in .get() using the feature_name class variable. A semester value can also be provided, which will change the initial semester state of the home page.

class courses.views.SchoolList(**kwargs)[source]
get(request, school)[source]

Provides the basic school information including the schools areas, departments, levels, and the time the data was last updated

courses.views.all_courses(request)[source]

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

courses.views.course_page(request, code)[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(*args, **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]

Append all eval instances with a flag designating whether there exists another eval for the course with the same 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.

class courses.serializers.EvaluationSerializer(*args, **kwargs)[source]
class courses.serializers.SectionSerializer(*args, **kwargs)[source]
class courses.serializers.SemesterSerializer(*args, **kwargs)[source]
courses.serializers.get_section_dict(section)[source]

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