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
5684c5d9
Commit
5684c5d9
authored
Jan 28, 2014
by
Daniel W Bond
Browse files
added slugfields to models
parent
99db2f08
Changes
1
Hide whitespace changes
Inline
Side-by-side
advisor/trajectories/models.py
View file @
5684c5d9
...
...
@@ -13,6 +13,7 @@ class BaseModel(models.Model):
class
Course
(
BaseModel
):
name
=
models
.
CharField
(
max_length
=
150
)
slug
=
models
.
SlugField
(
max_length
=
50
,
unique
=
True
)
# ordering
prerequisites
=
models
.
ManyToManyField
(
'Course'
,
related_name
=
'prereqField'
,
null
=
True
)
...
...
@@ -81,6 +82,8 @@ class Student(models.Model):
user
=
models
.
OneToOneField
(
User
)
# does User have a slug field?
alreadyTaken
=
models
.
ManyToManyField
(
'Course'
,
null
=
True
)
trajectory
=
models
.
ManyToManyField
(
'Trajectory'
,
null
=
True
)
...
...
@@ -105,6 +108,7 @@ post_save.connect(create_user_profile, sender=User)
class
Trajectory
(
BaseModel
):
name
=
models
.
CharField
(
max_length
=
150
)
slug
=
models
.
SlugField
(
max_length
=
50
,
unique
=
True
)
# Takes courses
previousCourses
=
models
.
ManyToManyField
(
'Trajectory'
,)
...
...
@@ -121,5 +125,3 @@ class Trajectory(BaseModel):
def
get_absolute_url
(
self
):
return
'my-trajectories/%s/'
%
self
.
slug
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