Skip to content
Snippets Groups Projects
Commit fcc8d024 authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

handling when object cannot be found with get_object_or_404

parent 0a36d39b
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ iPPI-DB contribution views
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db import transaction
from django.forms import model_to_dict
from django.shortcuts import render
from django.shortcuts import render, get_object_or_404
from django.utils.translation import ugettext_lazy
from formtools.wizard.views import NamedUrlSessionWizardView
......@@ -316,7 +316,7 @@ class IppiWizard(LoginRequiredMixin, NamedUrlSessionWizardView):
def admin_session_view(request, bibli_pk, ppi_pk):
context = {}
if bibli_pk:
bibliography = models.Bibliography.objects.get(pk=bibli_pk)
bibliography = get_object_or_404(models.Bibliography, pk=bibli_pk)
context["bibliography"] = bibliography
context["testactivitydescription"] = bibliography.testactivitydescription_set.all()
context["testcytotoxdescription"] = bibliography.testcytotoxdescription_set.all()
......@@ -324,7 +324,7 @@ def admin_session_view(request, bibli_pk, ppi_pk):
context["refcompoundbiblio"] = bibliography.refcompoundbiblio_set.all()
if ppi_pk:
ppi = models.Ppi.objects.get(pk=ppi_pk)
ppi = get_object_or_404(models.Ppi, pk=ppi_pk)
context["ppi"] = ppi
context["complexes"] = ppi.ppicomplex_set.all()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment