Models

Course Model

class amherst_coursework_algo.models.Course(*args, **kwargs)[source]

Course model representing an academic course at Amherst College.

Parameters:
  • id (IntegerField, primary key) -- Unique 7-digit course identifier Format: XYYZCZZ where: X: College/semester (4=Amherst Fall, 5=Amherst Spring) YY: Department code (00-99) Z: Credit flag (1=half-credit, 0=full-credit) CZZ: Course number (000-999) Example: 4140112 = Fall COSC-112

  • courseLink (URLField, optional) -- Direct URL to the course page on Amherst College's course catalog Defaults to null if not provided

  • courseName (CharField) -- Full title of the course as it appears in the course catalog Maximum length: 200 characters

  • courseCodes (ManyToManyField to CourseCode) -- Official course codes/numbers (e.g., "COSC-111", "MATH-271") Multiple codes possible for cross-listed courses

  • courseDescription (TextField, optional) -- Detailed description of course content, objectives, and requirements Can be blank

  • courseMaterialsLink (URLField, optional) -- URL to course materials, syllabus, or additional resources Defaults to null if not provided

  • keywords (ManyToManyField to Keyword) -- Searchable keywords/tags associated with the course content

  • divisions (ManyToManyField to Division) -- Academic divisions the course belongs to (e.g., "Science", "Humanities")

  • departments (ManyToManyField to Department) -- Academic departments offering the course

  • enrollmentText (TextField) -- Instructions for course enrollment and registration Defaults to "Contact the professor for enrollment details"

  • prefForMajor (BooleanField) -- Whether majors have enrollment priority Defaults to False

  • overallCap (PositiveIntegerField) -- Maximum total enrollment limit Defaults to 0 (no cap)

  • freshmanCap (PositiveIntegerField) -- Maximum number of freshmen allowed to enroll Defaults to 0 (no cap)

  • sophomoreCap (PositiveIntegerField) -- Maximum number of sophomores allowed to enroll Defaults to 0 (no cap)

  • juniorCap (PositiveIntegerField) -- Maximum number of juniors allowed to enroll Defaults to 0 (no cap)

  • seniorCap (PositiveIntegerField) -- Maximum number of seniors allowed to enroll Defaults to 0 (no cap)

  • credits (IntegerField) -- Number of credits awarded for completing the course Choices: 2 or 4 credits Defaults to 4

  • prereqDescription (TextField, optional) -- Text description of prerequisites and requirements Can be blank

  • recommended_courses (ManyToManyField to Course) -- Courses recommended but not required as prerequisites Self-referential relationship

  • professor_override (BooleanField) -- Whether professors can override prerequisite requirements Defaults to False

  • placement_course (ForeignKey to Course, optional) -- Reference to a placement test or course required Self-referential relationship

  • corequisites (ManyToManyField to Course) -- Courses that must be taken concurrently Self-referential, symmetrical relationship

  • professors (ManyToManyField to Professor) -- Professors teaching the course

  • sections (ReverseRelation via Section) -- Course sections with meeting times and locations One-to-many relationship from Section model

  • fallOfferings (ManyToManyField to Year) -- Years the course is offered in fall semester

  • springOfferings (ManyToManyField to Year) -- Years the course is offered in spring semester

  • janOfferings (ManyToManyField to Year) -- Years the course is offered in January term

__str__()[source]

Returns the course name as a string

Examples

>>> course = Course.objects.create(
...     id=4140111,
...     courseName="Introduction to Computer Science I",
...     credits=4
... )
>>> course.departments.add(Department.objects.get(code="COSC"))
>>> course.courseCodes.create(value="COSC-111")
exception DoesNotExist
exception MultipleObjectsReturned
clean()[source]

Validates that year-specific enrollment caps don't exceed overall cap

CourseCode Model

class amherst_coursework_algo.models.CourseCode(*args, **kwargs)[source]

CourseCode model representing course codes/abbreviations.

Parameters:

value (CharField) -- The 8-9 character course code (e.g., "COSC-111", "CHEM-165L") Must follow department code + hyphen + number format + (optional) letter suffix

exception DoesNotExist
exception MultipleObjectsReturned

Department Model

class amherst_coursework_algo.models.Department(*args, **kwargs)[source]

Department model representing academic departments at Amherst College.

Parameters:
  • name (CharField) -- The full name of the department (e.g., "Computer Science", "Biology")

  • code (CharField) -- The 4-letter department code (e.g., "COSC", "BCBP")

  • link (URLField) -- The link to the department page on amherst.edu

exception DoesNotExist
exception MultipleObjectsReturned

PrerequisiteSet Model

class amherst_coursework_algo.models.PrerequisiteSet(*args, **kwargs)[source]

PrerequisiteSet model representing a set of prerequisites for a course.

Parameters:
  • prerequisite_for (ForeignKey) -- Course this set of prerequisites is for

  • courses (ManyToManyField) -- One set of courses that can be completed to satisfy prerequisites

exception DoesNotExist
exception MultipleObjectsReturned

Professor Model

class amherst_coursework_algo.models.Professor(*args, **kwargs)[source]

Professor model representing course instructors.

Parameters:
  • name (CharField) -- Full name of the professor

  • link (URLField) -- URL to professor's page on amherst.edu

exception DoesNotExist
exception MultipleObjectsReturned

Section Model

class amherst_coursework_algo.models.Section(*args, **kwargs)[source]

Section model representing a specific course section with location, professor, and meeting time.

Parameters:
  • section_number (CharField) -- The section number (digits with optional letter suffix)

  • section_for (ForeignKey) -- Course this section is for

  • monday_start_time (TimeField) -- Start time for Monday meeting

  • monday_end_time (TimeField) -- End time for Monday meeting

  • tuesday_start_time (TimeField) -- Start time for Tuesday meeting

  • tuesday_end_time (TimeField) -- End time for Tuesday meeting

  • wednesday_start_time (TimeField) -- Start time for Wednesday meeting

  • wednesday_end_time (TimeField) -- End time for Wednesday meeting

  • thursday_start_time (TimeField) -- Start time for Thursday meeting

  • thursday_end_time (TimeField) -- End time for Thursday meeting

  • friday_start_time (TimeField) -- Start time for Friday meeting

  • friday_end_time (TimeField) -- End time for Friday meeting

  • saturday_start_time (TimeField) -- Start time for Saturday meeting

  • saturday_end_time (TimeField) -- End time for Saturday meeting

  • sunday_start_time (TimeField) -- Start time for Sunday meeting

  • sunday_end_time (TimeField) -- End time for Sunday meeting

  • location (CharField) -- Building and room number

  • professor (ForeignKey) -- Professor teaching this section

exception DoesNotExist
exception MultipleObjectsReturned
clean()[source]

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

Year Model

class amherst_coursework_algo.models.Year(*args, **kwargs)[source]

Year model representing the academic year (specfic to each course).

Parameters:
  • id (IntegerField) -- Unique identifier for the academic year/link combo

  • year (IntegerField) -- Academic year (e.g., 2021)

  • link (URLField) -- URL link to course catalog

exception DoesNotExist
exception MultipleObjectsReturned

Keyword Model

class amherst_coursework_algo.models.Keyword(*args, **kwargs)[source]

Keyword model representing keywords associated with courses.

Parameters:

name (CharField) -- The keyword value

exception DoesNotExist
exception MultipleObjectsReturned

Division Model

class amherst_coursework_algo.models.Division(*args, **kwargs)[source]

Division model representing academic divisions at Amherst College.

Parameters:

name (CharField) -- The full name of the division (e.g., "Science & Mathematics", "Social Sciences")

exception DoesNotExist
exception MultipleObjectsReturned