Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nathan R Lapierre
advisor
Commits
f8593f45
Commit
f8593f45
authored
Dec 09, 2013
by
Daniel W Bond
Browse files
probably should commit at this point-- some urling, and other stuff
parent
cd6db21d
Changes
1
Hide whitespace changes
Inline
Side-by-side
advisor/trajectories/models.py
View file @
f8593f45
from
django.db
import
models
from
django.contrib.auth.models
import
User
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
):
name
=
models
.
CharField
(
max_length
=
150
)
# ordering
prerequisites
=
models
.
ManyToManyField
(
'Course'
,
related_name
=
'prereqField'
,
null
=
True
)
corequisites
=
models
.
ManyToManyField
(
'Course'
,
related_name
=
'coreqField'
,
null
=
True
)
...
...
@@ -28,8 +30,6 @@ class Course(BaseModel):
# Course may need program-specific information
slug
=
models
.
SlugField
(
max_length
=
50
)
# default sorting order in admin
class
Meta
:
ordering
=
(
'name'
,)
...
...
@@ -43,6 +43,8 @@ class Course(BaseModel):
# gen eds are coursecollections in programs
class
CourseCollection
(
BaseModel
):
name
=
models
.
CharField
(
max_length
=
150
)
# a number of courses
courses
=
models
.
ManyToManyField
(
'Course'
,)
...
...
@@ -51,6 +53,8 @@ class CourseCollection(BaseModel):
class
Program
(
BaseModel
):
name
=
models
.
CharField
(
max_length
=
150
)
# courseCollections
courseReqs
=
models
.
ManyToManyField
(
'CourseCollection'
,)
...
...
@@ -69,13 +73,16 @@ class Program(BaseModel):
# should inherit from the standard Django User Model
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
)
trajectory
=
models
.
ManyToManyField
(
'Trajectory'
,
null
=
True
)
# aka username, etc should all be here
slug
=
models
.
SlugField
(
max_length
=
50
)
class
Meta
:
ordering
=
(
'name'
,)
...
...
@@ -87,7 +94,7 @@ class Student(BaseModel):
class
Trajectory
(
BaseModel
):
#
name
randomly generated
name
=
models
.
CharField
(
max_length
=
150
)
# Takes courses
previousCourses
=
models
.
ManyToManyField
(
'Course'
,)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment