Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/tiny bugs #869

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
301 changes: 93 additions & 208 deletions locale/en/LC_MESSAGES/django.po

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ <h2>{% trans "Startdatum aanpassen" %}</h2>
<a class="btn btn-secondary" href="javascript:history.go(-1);">{% trans "Terug naar de vorige pagina" %}</a>
<input class="btn btn-primary ms-auto"
type="submit"
value="{% trans 'Startdatum aanpassen' %}" />
value="{% trans 'Wijzigingen opslaan' %}" />
{% endblock %}
6 changes: 5 additions & 1 deletion proposals/views/attachment_views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.views import generic
from django import forms
from django.urls import reverse
from django.http import Http404
from django import forms
from django.conf import settings
from main.views import UpdateView
Expand Down Expand Up @@ -139,7 +140,10 @@ def get_proposal(self):
def get_owner_object(self):
owner_class = self.owner_model
other_pk = self.kwargs.get("other_pk")
return owner_class.objects.get(pk=other_pk)
try:
return owner_class.objects.get(pk=other_pk)
except owner_class.DoesNotExist:
raise Http404

def get_kind(self):
kind_str = self.kwargs.get("kind", None)
Expand Down
7 changes: 5 additions & 2 deletions proposals/views/wmo_views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-

from django.urls import reverse
from django.http import JsonResponse
from django.http import JsonResponse, Http404
from django.views import generic
from django.views.decorators.csrf import csrf_exempt
from django.utils.translation import gettext_lazy as _
Expand Down Expand Up @@ -67,7 +67,10 @@ def form_valid(self, form):

def get_proposal(self):
"""Retrieves the Proposal from the pk kwarg"""
return Proposal.objects.get(pk=self.kwargs["pk"])
try:
return Proposal.objects.get(pk=self.kwargs["pk"])
except Proposal.DoesNotExist:
raise Http404


class WmoUpdate(
Expand Down
4 changes: 1 addition & 3 deletions studies/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ def clean(self):
"""
cleaned_data = super(StudyForm, self).clean()

self.mark_soft_required(
cleaned_data, "compensation", "recruitment", "hierarchy"
)
self.mark_soft_required(cleaned_data, "compensation", "hierarchy")

self.necessity_required(cleaned_data)
self.check_dependency(
Expand Down
7 changes: 6 additions & 1 deletion studies/mixins.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from django.http import Http404

from .models import Study
from proposals.mixins import StepperContextMixin

Expand All @@ -16,7 +18,10 @@ class StudyFromURLMixin:

def get_study(self):
"""Retrieves the Study from the pk kwarg"""
return Study.objects.get(pk=self.kwargs["pk"])
try:
return Study.objects.get(pk=self.kwargs["pk"])
except Study.DoesNotExist:
raise Http404

def get_proposal(
self,
Expand Down
2 changes: 1 addition & 1 deletion studies/templates/studies/study_update_attachments.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ <h2>{% trans "Formulieren aanpassen" %}</h2>
<a class="btn btn-secondary" href="javascript:history.go(-1);">{% trans "Terug naar de vorige pagina" %}</a>
<input class="btn btn-primary ms-auto"
type="submit"
value="{% trans 'Formulieren aanpassen' %}" />
value="{% trans 'Wijzigingen opslaan' %}" />
{% endblock %}
2 changes: 1 addition & 1 deletion studies/views/study_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def form_valid(self, form):

def get_success_url(self):
"""Continue to the URL specified in the 'next' POST parameter"""
return self.request.POST.get("next", "/")
return reverse("reviews:detail", args=[self.object.proposal.latest_review().pk])


################
Expand Down
7 changes: 5 additions & 2 deletions tasks/views/task_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Any
from django.urls import reverse
from django.http import HttpResponseRedirect
from django.http import HttpResponseRedirect, Http404
from django.utils.translation import gettext_lazy as _

from main.views import AllowErrorsOnBackbuttonMixin, UpdateView, DeleteView, CreateView
Expand Down Expand Up @@ -64,7 +64,10 @@ def form_valid(self, form):

def get_session(self):
"""Retrieves the Study from the pk kwarg"""
return Session.objects.get(pk=self.kwargs["pk"])
try:
return Session.objects.get(pk=self.kwargs["pk"])
except Session.DoesNotExist:
raise Http404

def get_proposal(self):
return self.get_session().study.proposal
Expand Down
Loading