diff --git a/coinmanager/coinc/views.py b/coinmanager/coinc/views.py index 6455269..00c41fb 100644 --- a/coinmanager/coinc/views.py +++ b/coinmanager/coinc/views.py @@ -20,7 +20,7 @@ from datetime import datetime from json import dumps -from django.http import HttpResponse +from django.http import HttpResponse, Http404 from django.template import loader from django.template.defaultfilters import register @@ -45,7 +45,11 @@ def detail_country(request, name_iso): ''' wrapper_view for a *single* country ''' template = loader.get_template('coinc/country.html') - country = Country.objects.get(name_iso=name_iso) + try: + country = Country.objects.get(name_iso=name_iso) + except Country.DoesNotExist: + raise Http404(f"Das Land '{name_iso}' ist nicht vorhanden") + context = show_country(country, single_country=True) return HttpResponse(template.render(context, request))