Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
roomlist
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SRCT
roomlist
Commits
4468c0e3
Commit
4468c0e3
authored
Oct 04, 2016
by
Daniel W Bond
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modified form fields, instantiation, and chosen.js options to render major for update_student
parent
6403bbb2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
roomlist/accounts/forms.py
roomlist/accounts/forms.py
+1
-1
roomlist/accounts/templates/update_student.html
roomlist/accounts/templates/update_student.html
+2
-2
roomlist/accounts/views.py
roomlist/accounts/views.py
+2
-1
No files found.
roomlist/accounts/forms.py
View file @
4468c0e3
...
...
@@ -80,7 +80,7 @@ class StudentUpdateForm(forms.Form):
room
=
SelectRoomField
(
queryset
=
Room
.
objects
.
all
(),
required
=
False
)
privacy
=
forms
.
TypedChoiceField
(
choices
=
Student
.
PRIVACY_CHOICES
)
major
=
forms
.
ModelChoiceField
(
queryset
=
Major
.
objects
.
all
(),
required
=
False
)
major
=
forms
.
Model
Multiple
ChoiceField
(
queryset
=
Major
.
objects
.
all
(),
required
=
False
)
graduating_year
=
forms
.
IntegerField
()
def
clean
(
self
):
...
...
roomlist/accounts/templates/update_student.html
View file @
4468c0e3
...
...
@@ -212,7 +212,7 @@
</div>
<div
class=
"form-group"
>
<label
for=
"{{ my_form.major.id_for_label }}"
class=
"col-md-2"
>
Major
<br
/>
(select one
)
Major
(s
)
</label>
<div
class=
"col-md-4"
>
{{ my_form.major }}
...
...
@@ -268,7 +268,7 @@
<script
type=
"text/javascript"
src=
"/static/js/chained.min.js"
></script>
<script
type=
"text/javascript"
src=
"/static/js/chosen.min.js"
></script>
<script>
$
(
"
.chosen-select
"
).
chosen
(
)
$
(
"
.chosen-select
"
).
chosen
(
{
max_selected_options
:
2
});
</script>
{% include 'room_selection_script.html' %}
{% endblock javascript %}
roomlist/accounts/views.py
View file @
4468c0e3
...
...
@@ -154,6 +154,7 @@ class UpdateStudent(LoginRequiredMixin, FormValidMessageMixin, FormView):
context
=
super
(
UpdateStudent
,
self
).
get_context_data
(
**
kwargs
)
me
=
Student
.
objects
.
get
(
user
=
self
.
request
.
user
)
majors
=
[
pk_or_none
(
me
,
major
)
for
major
in
me
.
major
.
all
()]
form
=
StudentUpdateForm
(
initial
=
{
'first_name'
:
me
.
user
.
first_name
,
'last_name'
:
me
.
user
.
last_name
,
...
...
@@ -161,7 +162,7 @@ class UpdateStudent(LoginRequiredMixin, FormValidMessageMixin, FormView):
'show_gender'
:
me
.
show_gender
,
'room'
:
pk_or_none
(
me
,
me
.
room
),
'privacy'
:
me
.
privacy
,
'major'
:
pk_or_none
(
me
,
me
.
major
)
,
'major'
:
majors
,
'graduating_year'
:
me
.
graduating_year
,
'on_campus'
:
me
.
on_campus
,
})
...
...
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