Commit 1b79d949 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

models written

parent 081940d0
from django.db import models
# Create your models here.
class BaseModel(models.Model):
created = models.DateTimeField('Created', auto_now_add=True, editable=False)_
last_modified = models.DateTimeField('Last Modified', auto_now=True)
name = models.CharField(max_length = 100)
class Meta:
abstract = True
class Course(BaseModel):
department = models.CharField(max_length = 5)
courseNumber = models.CharField(max_length = 3)
# available next semester?
# CRN
# section number
slug = models.SlugField(max_length = 50)
# ordering
prerequisites = models.ManyToManyField()
corequisites = models.ManyToManyField()
# default sorting order in admin
class Meta:
ordering = ('name',)
def __unicode__(self):
return self.name
def get_absolute_url(self):
return '/courses/%s/' % self.slug
class Trajectory(BaseModel):
# Unsure how to represent this
# Kind of want to overwrite "name" as optional
# Takes courses
potentialTrajectory = models.ManyToManyField()
def get_absolute_url(self):
return 'my-trajectories/%s/' % self.slug
# should inherit from the standard Django User Model
class Student(BaseModel):
alreadyTaken = models.ManyToManyField()
trajectory = models.ManyToField()
slug = models.SlugField(max_length = 50)
class Meta:
ordering = ('name',)
def __unicode__(self):
return self.name
def get_absolute_url(self):
return '/%s/' % self.slug
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment