SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
9932050b
Commit
9932050b
authored
8 years ago
by
Geert Kapteijns
Browse files
Options
Downloads
Patches
Plain Diff
Improve PEP and comment better
parent
2fd40d4a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theses/views.py
+6
-13
6 additions, 13 deletions
theses/views.py
with
6 additions
and
13 deletions
theses/views.py
+
6
−
13
View file @
9932050b
...
...
@@ -51,15 +51,6 @@ class UnvettedThesisLinks(ListView):
context_object_name
=
'
thesislinks
'
queryset
=
ThesisLink
.
objects
.
filter
(
vetted
=
False
)
# @method_decorator(permission_required(
# 'scipost.can_vet_thesislink_requests', raise_exception=True), name='dispatch')
# class VetThesisLink(UpdateView):
# model = ThesisLink
# fields = ['type', 'discipline', 'domain', 'subject_area',
# 'title', 'author', 'supervisor', 'institution',
# 'defense_date', 'pub_link', 'abstract']
# template_name = "theses/vet_thesislink.html"
@method_decorator
(
permission_required
(
'
scipost.can_vet_thesislink_requests
'
,
raise_exception
=
True
),
name
=
'
dispatch
'
)
...
...
@@ -73,17 +64,19 @@ class VetThesisLink(UpdateView):
# I totally override the form_valid method. I do not call super.
# This is because, by default, an UpdateView saves the object as instance,
# which it builds from the form data. So, the changes (by whom the thesis link was vetted, etc.)
# would be lost.
# would be lost. Instead, we need the form to save with commit=False, then modify
# the vetting fields, and then save.
# Builds model that reflects changes made during update. Does not yet save.
self
.
object
=
form
.
save
(
commit
=
False
)
# Process vetting actions
# Process vetting actions
(object already gets saved.)
form
.
vet_request
(
self
.
object
,
self
.
request
.
user
)
# Save again.
self
.
object
.
save
()
messages
.
add_message
(
self
.
request
,
messages
.
SUCCESS
,
strings
.
acknowledge_vet_thesis_link
)
messages
.
add_message
(
self
.
request
,
messages
.
SUCCESS
,
strings
.
acknowledge_vet_thesis_link
)
return
HttpResponseRedirect
(
self
.
get_success_url
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment