Source

Ochs / courses / models.py

Full commit
import datetime

from django.db import models

from staff.models import Profile, FACULTY

def current_year():
    return datetime.datetime.now().year

class Term(models.Model):
    name = models.CharField(max_length=25)
    slug = models.SlugField()
    
class Course(models.Model):
    title = models.TextField()
    section = models.CharField(max_length=12)
    term = models.ForeignKey(Term)
    year = models.PositiveIntegerField(default=current_year)
    description = models.TextField()
    professor = models.ForeignKey(Profile, limit_choices_to={'position__position__contains': FACULTY})
    last_modified = models.DateTimeField(auto_now=True, editable=False)
    students = models.ManyToManyField(Profile, related_name='students')