Overview
Student registration in ESP is handled by two primary models:- StudentRegistration: Links students to specific class sections with a relationship type
- StudentSubjectInterest: Indicates student interest in a class subject
esp/esp/program/models/__init__.py
StudentRegistration Model
Tracks a student’s relationship to a specific class section (enrolled, interested, priority, etc.). Line:esp/esp/program/models/__init__.py:2199
Core Fields
Class section this registration is for
- Links to:
ClassSection - Cannot be null
Student being registered
- Links to:
ESPUser - Cannot be null
Type of registration relationship
- Links to:
RegistrationType - Common values: Enrolled, Interested, Priority/1, Priority/2, Applied, Attended
- Cannot be null
ExpirableModel Fields
Inherited from ExpirableModel base class:When this registration became active
- Default: Current timestamp on creation
- Null allowed (means active since beginning of time)
When this registration ended/was removed
- Null means currently active
- Set to current time when registration is deleted/changed
String Representation
RegistrationType Model
Defines the types of relationships students can have with classes. Common Registration Types:Student is officially enrolled in the class
- Category: student
- Used for: Final enrollment, class rosters
Student expressed interest but not enrolled
- Category: student
- Used for: Initial interest, lottery systems
Student’s ranked preferences
- Category: student
- Used for: Lottery registration, priority systems
Student submitted application for class
- Category: student
- Used for: Classes requiring applications
Student actually attended the class
- Category: student
- Used for: Onsite check-in tracking
StudentSubjectInterest Model
Indicates a student is interested in a class subject (not a specific section). Line:esp/esp/program/models/__init__.py:2214
Fields
Class subject student is interested in
- Links to:
ClassSubject - Cannot be null
Student expressing interest
- Links to:
ESPUser - Cannot be null
When interest was recorded
- From ExpirableModel
When interest ended
- From ExpirableModel
- Null = currently interested
Working with Registrations
Querying Active Registrations
The ExpirableModel provides special querysets:Returns manager that filters to currently valid registrationsExample:
Returns Q object for filtering valid registrationsExample:
Creating Registrations
Creates a new registration recordExample:
Ending Registrations
To remove a student from a class, set the end_date rather than deleting:expire()
Marks registration as endedExample:
Usage Examples
Enrolling a Student
Checking Student’s Schedule
Priority/Lottery Registration
Moving Student Between Sections
Checking Class Attendance
Getting Registration History
Bulk Registration Updates
Converting Interest to Enrollment
Related Models
- ClassSection - Sections students register for
- User - Students being registered
- Program - Parent program containing classes
RegistrationType- Defines relationship types (Enrolled, Interested, etc.)