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
Daniel W Bond
advisor
Commits
1b79d949
Commit
1b79d949
authored
Dec 04, 2013
by
Daniel W Bond
Browse files
models written
parent
081940d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
advisor/trajectories/models.py
View file @
1b79d949
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
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