Skip to content

Commit

Permalink
Merge pull request #613 from DH-IT-Portal-Development/fix/supervisor-…
Browse files Browse the repository at this point in the history
…edit

Redirect supervisor to the right update page
  • Loading branch information
tymees authored Feb 26, 2024
2 parents fc7c120 + a0ab066 commit b1e707f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 0 additions & 1 deletion reviews/templates/reviews/decision_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<h2>{% trans "Aanvraag beoordelen" %}</h2>
{% with proposal=decision.review.proposal %}
{% url 'proposals:pdf' proposal.id as pdf_url %}
{% url 'proposals:update' proposal.id as update_url %}
{% if user != proposal.supervisor %}
<p>
{% blocktrans trimmed with title=proposal.title refnum=proposal.reference_number chamber=proposal.reviewing_committee %}
Expand Down
20 changes: 20 additions & 0 deletions reviews/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,26 @@ class DecisionUpdateView(
model = Decision
form_class = DecisionForm

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

# Supervisors get the chance to update the proposal, but we have
# multiple update views for different types of proposals.
if self.object.review.proposal.is_pre_approved:
context["update_url"] = reverse(
"proposals:update_pre_approved", args=[self.object.review.proposal.pk]
)
elif self.object.review.proposal.is_pre_assessment:
context["update_url"] = reverse(
"proposals:update_pre", args=[self.object.review.proposal.pk]
)
else:
context["update_url"] = reverse(
"proposals:update", args=[self.object.review.proposal.pk]
)

return context

def get_success_url(self):
obj = self.get_object()
if obj.review.is_committee_review:
Expand Down

0 comments on commit b1e707f

Please sign in to comment.