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
f62d4d03
Commit
f62d4d03
authored
Feb 15, 2014
by
Daniel W Bond
Browse files
buildtrajectoryform should be fixed
parent
6224b923
Changes
2
Hide whitespace changes
Inline
Side-by-side
advisor/trajectories/forms.py
View file @
f62d4d03
...
...
@@ -59,36 +59,31 @@ class NewMinorForm( ModelForm ):
}),
}
# the user selects the courses they are allowed to take but
# this needs to be presented in a dramatically different way than
# just some silly dropdown
# build a trajectory
class
BuildTrajectoryForm
(
ModelForm
):
# def __init__(self, *args, **kwargs):
class
Meta
:
model
=
Trajectory
fields
=
(
'name'
,
'courses'
,
)
exclude
=
(
'
trajectorySlug
'
,
'previousCourses'
,
'whichPrograms'
,
exclude
=
(
'
slug'
,
'owner
'
,
'previousCourses'
,
'whichPrograms'
,
'isPublic'
,
'semester'
)
labels
=
(
labels
=
{
# the courses need to be sorted by their associated program, so idk labels
)
'name'
:
'Trajectory Name'
,
'courses'
:
'Courses You Can Take This Semester'
,
}
widgets
=
{
# name of the trajectory
# this should be generated automatically, e.g.
# Daniel's Music Theory and Biology Minor v. 4 Trajectory
'name'
:
forms
.
TextInput
(
attrs
=
{
'class'
:
'form-control'
,
# this shouldn't change often
'placeholder'
=
'Name Your Trajectory'
,
}),
# course names... this isn't probably right
# users select and save tiles...
'name'
:
forms
.
TextInput
(
attrs
=
{
# users select and save tiles... don't use the widget
'courses'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'form-control'
,
'placeholder'
=
'Name Your Trajectory'
,
}),
}
...
...
@@ -105,7 +100,6 @@ class StudentUpdateForm( ModelForm ):
'semester'
:
'Semester'
,
}
widgets
=
{
# this should be done above, but I don't know how that works with the models ^^^
'completedCourses'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'form-control'
,
# 'placeholder' : 'Type in courses you\'ve taken',
...
...
advisor/trajectories/models.py
View file @
f62d4d03
...
...
@@ -108,6 +108,8 @@ class GenEd(Program):
pass
class
Trajectory
(
TimeStampedModel
):
# This should be generated automatically, e.g. Daniel's Music Theory
# and Biology Minor v. 4 Trajectory
name
=
models
.
CharField
(
max_length
=
150
)
slug
=
AutoSlugField
(
populate_from
=
'name'
,
unique
=
True
)
owner
=
models
.
ForeignKey
(
User
)
...
...
@@ -140,9 +142,8 @@ class Trajectory(TimeStampedModel):
# should inherit from the standard Django User Model
class
Student
(
models
.
Model
):
user
=
models
.
OneToOneField
(
User
)
# does User have a slug field?
# aka username, etc should all be here
# does User have a slug field?
# all of the student's trajectories
trajectories
=
models
.
ManyToManyField
(
'Trajectory'
,
null
=
True
)
...
...
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