Commit f8593f45 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

probably should commit at this point-- some urling, and other stuff

parent cd6db21d
from django.db import models from django.db import models
from django.contrib.auth.models import User
class BaseModel(models.Model): class BaseModel(models.Model):
created = models.DateTimeField('Created', auto_now_add=True, editable=False) created = models.DateTimeField('Created', auto_now_add=True, editable=False)
last_modified = models.DateTimeField('Last Modified', auto_now=True) last_modified = models.DateTimeField('Last Modified', auto_now=True)
name = models.CharField(max_length = 100)
class Meta: class Meta:
abstract = True abstract = True
class Course(BaseModel): class Course(BaseModel):
name = models.CharField(max_length = 150)
# ordering # ordering
prerequisites = models.ManyToManyField('Course', related_name = 'prereqField', null=True) prerequisites = models.ManyToManyField('Course', related_name = 'prereqField', null=True)
corequisites = models.ManyToManyField('Course', related_name = 'coreqField', null=True) corequisites = models.ManyToManyField('Course', related_name = 'coreqField', null=True)
...@@ -28,8 +30,6 @@ class Course(BaseModel): ...@@ -28,8 +30,6 @@ class Course(BaseModel):
# Course may need program-specific information # Course may need program-specific information
slug = models.SlugField(max_length = 50)
# default sorting order in admin # default sorting order in admin
class Meta: class Meta:
ordering = ('name',) ordering = ('name',)
...@@ -43,6 +43,8 @@ class Course(BaseModel): ...@@ -43,6 +43,8 @@ class Course(BaseModel):
# gen eds are coursecollections in programs # gen eds are coursecollections in programs
class CourseCollection(BaseModel): class CourseCollection(BaseModel):
name = models.CharField(max_length = 150)
# a number of courses # a number of courses
courses = models.ManyToManyField('Course',) courses = models.ManyToManyField('Course',)
...@@ -51,6 +53,8 @@ class CourseCollection(BaseModel): ...@@ -51,6 +53,8 @@ class CourseCollection(BaseModel):
class Program(BaseModel): class Program(BaseModel):
name = models.CharField(max_length = 150)
# courseCollections # courseCollections
courseReqs = models.ManyToManyField('CourseCollection',) courseReqs = models.ManyToManyField('CourseCollection',)
...@@ -69,13 +73,16 @@ class Program(BaseModel): ...@@ -69,13 +73,16 @@ class Program(BaseModel):
# should inherit from the standard Django User Model # should inherit from the standard Django User Model
class Student(BaseModel): class Student(BaseModel):
user = models.OneToOneField(User)
# might there be a problem with the name field in base?
# should this be a trajectory instead? >_>
alreadyTaken = models.ManyToManyField('Course', null=True) alreadyTaken = models.ManyToManyField('Course', null=True)
trajectory = models.ManyToManyField('Trajectory', null=True) trajectory = models.ManyToManyField('Trajectory', null=True)
# aka username, etc should all be here # aka username, etc should all be here
slug = models.SlugField(max_length = 50)
class Meta: class Meta:
ordering = ('name',) ordering = ('name',)
...@@ -87,7 +94,7 @@ class Student(BaseModel): ...@@ -87,7 +94,7 @@ class Student(BaseModel):
class Trajectory(BaseModel): class Trajectory(BaseModel):
# name randomly generated name = models.CharField(max_length = 150)
# Takes courses # Takes courses
previousCourses = models.ManyToManyField('Course',) previousCourses = models.ManyToManyField('Course',)
......
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