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
SRCT
roomlist
Commits
4d8337c7
Commit
4d8337c7
authored
Mar 26, 2015
by
Daniel W Bond
Browse files
new urls for updatestudent
parent
ecf036dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
roomlist/accounts/views.py
View file @
4d8337c7
from
django.shortcuts
import
render
,
get_object_or_404
from
django.views.generic
import
DetailView
,
ListView
,
Cre
ateView
,
UpdateView
,
DeleteView
from
django.views.generic
import
DetailView
,
ListView
,
Upd
ateView
,
UpdateView
,
DeleteView
from
accounts.models
import
Student
from
accounts.forms
import
StudentForm
from
braces.views
import
LoginRequiredMixin
#
cre
ate a student
class
Cre
ateStudent
(
LoginRequiredMixin
,
Cre
ateView
):
#
upd
ate a student
(students are *created* on first login via CAS)
class
Upd
ateStudent
(
LoginRequiredMixin
,
Upd
ateView
):
model
=
Student
f
orm_class
=
StudentForm
success_url
=
'/'
#redirect location tba
f
ields
=
[
'room'
,
'privacy'
,]
login_url
=
'/'
# copied from below
def
get_object
(
self
):
return
get_object_or_404
(
Student
,
pk
=
self
.
request
.
session
[
'_auth_user_id'
])
# details about the student
class
DetailStudent
(
LoginRequiredMixin
,
DetailView
):
model
=
Student
...
...
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