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
5c31f62b
Commit
5c31f62b
authored
May 26, 2017
by
Daniel W Bond
Browse files
additional duplicate code removed through studentcontextmixin
parent
f8d3826e
Changes
1
Show whitespace changes
Inline
Side-by-side
roomlist/accounts/views.py
View file @
5c31f62b
...
...
@@ -21,6 +21,7 @@ from .forms import StudentUpdateForm, FarewellFeedbackForm
from
housing.models
import
Room
from
core.utils
import
(
shadowbanning
,
on_the_same_floor
,
pk_or_none
,
create_email
,
no_nums
)
from
core.views
import
StudentContextMixin
# details about the student
...
...
@@ -275,7 +276,7 @@ class UpdateStudent(LoginRequiredMixin, FormValidMessageMixin, FormView):
kwargs
=
{
'slug'
:
self
.
request
.
user
.
username
})
class
DeleteStudent
(
FormView
):
class
DeleteStudent
(
LoginRequiredMixin
,
StudentContextMixin
,
FormView
):
form_class
=
FarewellFeedbackForm
template_name
=
'delete_student.html'
...
...
@@ -302,15 +303,6 @@ class DeleteStudent(FormView):
else
:
return
super
(
DeleteStudent
,
self
).
get
(
request
,
*
args
,
**
kwargs
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
DeleteStudent
,
self
).
get_context_data
(
**
kwargs
)
me
=
self
.
request
.
user
.
student
context
[
'student'
]
=
me
return
context
def
form_valid
(
self
,
form
):
user
=
self
.
request
.
user
student
=
self
.
request
.
user
.
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