Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
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
ots
hypha
Commits
ce75c7ec
Commit
ce75c7ec
authored
6 years ago
by
Dan Braghis
Committed by
Todd Dembrey
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update the review list
parent
87ce3836
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
opentech/apply/review/views.py
+17
-18
17 additions, 18 deletions
opentech/apply/review/views.py
with
17 additions
and
18 deletions
opentech/apply/review/views.py
+
17
−
18
View file @
ce75c7ec
import
json
from
django.core.exceptions
import
PermissionDenied
from
django.http
import
HttpResponseRedirect
from
django.shortcuts
import
get_object_or_404
...
...
@@ -7,7 +9,9 @@ from django.views.generic import ListView, DetailView
from
opentech.apply.activity.messaging
import
messenger
,
MESSAGES
from
opentech.apply.funds.models
import
ApplicationSubmission
from
opentech.apply.review.blocks
import
ScoreFieldBlock
from
opentech.apply.review.forms
import
ReviewModelForm
from
opentech.apply.review.options
import
RATE_CHOICES
,
NA
from
opentech.apply.users.decorators
import
staff_required
from
opentech.apply.utils.views
import
CreateOrUpdateView
...
...
@@ -115,33 +119,28 @@ class ReviewListView(ListView):
return
super
().
get_queryset
()
def
get_context_data
(
self
,
**
kwargs
):
form_used
=
get_form_for_stage
(
self
.
submission
)
review_data
=
{}
choices
=
dict
(
RATE_CHOICES
)
not_available
=
choices
[
NA
]
for
review
in
self
.
object_list
:
# Add the name header row
review_data
.
setdefault
(
''
,
[]).
append
(
str
(
review
.
author
))
review_data
.
setdefault
(
'
Score
'
,
[]).
append
(
str
(
review
.
score
))
for
name
,
field
in
form_used
.
base_fields
.
items
():
try
:
# Add titles which exist
title
=
form_used
.
titles
[
field
.
group
]
for
data
,
field
in
review
.
data_and_fields
():
title
=
field
.
value
[
'
field_label
'
]
review_data
.
setdefault
(
title
,
[])
except
AttributeError
:
pass
for
review
in
self
.
object_list
:
value
=
review
.
review
[
name
]
try
:
choices
=
dict
(
field
.
choices
)
except
AttributeError
:
pass
else
:
# Update the stored value to the display value
value
=
choices
[
int
(
value
)]
review_data
.
setdefault
(
field
.
label
,
[]).
append
(
str
(
value
))
if
isinstance
(
field
.
block
,
ScoreFieldBlock
):
value
=
json
.
loads
(
data
)
review_data
.
setdefault
(
title
,
[]).
append
(
str
(
value
[
0
]))
review_data
.
setdefault
(
f
'
Rate
{
title
}
'
,
[])
rating
=
int
(
value
[
1
])
review_data
.
setdefault
(
f
'
Rate
{
title
}
'
,
[]).
append
(
choices
.
get
(
rating
,
not_available
))
else
:
review_data
.
setdefault
(
title
,
[]).
append
(
str
(
data
))
return
super
().
get_context_data
(
submission
=
self
.
submission
,
...
...
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