Commit 6e3fcd8b authored by Daniel W Bond's avatar Daniel W Bond
Browse files

added appropriate error levels to success/fail for facility retrieval

parent 2ce18e40
Pipeline #2174 passed with stage
...@@ -9,6 +9,7 @@ https://docs.djangoproject.com/en/1.11/ref/contrib/admin/ ...@@ -9,6 +9,7 @@ https://docs.djangoproject.com/en/1.11/ref/contrib/admin/
""" """
# Django Imports # Django Imports
from django.contrib import admin from django.contrib import admin
from django.contrib import messages
from django.contrib.gis.admin import OSMGeoAdmin from django.contrib.gis.admin import OSMGeoAdmin
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
...@@ -47,7 +48,8 @@ class FacilityAdmin(admin.ModelAdmin): ...@@ -47,7 +48,8 @@ class FacilityAdmin(admin.ModelAdmin):
"Set %s as the main schedule for %d facilities." % (name, num)) "Set %s as the main schedule for %d facilities." % (name, num))
except ObjectDoesNotExist: except ObjectDoesNotExist:
self.message_user(request, self.message_user(request,
"Unable to set a new main schedule for %d facilities." % num) "Unable to set a new main schedule for %d facilities." % num,
level=messages.ERROR)
return HttpResponseRedirect(request.get_full_path()) return HttpResponseRedirect(request.get_full_path())
return render(request, return render(request,
'bulk_schedules_intermediate.html', 'bulk_schedules_intermediate.html',
...@@ -68,7 +70,8 @@ class FacilityAdmin(admin.ModelAdmin): ...@@ -68,7 +70,8 @@ class FacilityAdmin(admin.ModelAdmin):
"Added %s as a special schedule to %d facilities." % (name, num)) "Added %s as a special schedule to %d facilities." % (name, num))
except ObjectDoesNotExist: except ObjectDoesNotExist:
self.message_user(request, self.message_user(request,
"Unable to add additional special schedule to %d facilities." % num) "Unable to add additional special schedule to %d facilities." % num,
level=messages.ERROR)
return HttpResponseRedirect(request.get_full_path()) return HttpResponseRedirect(request.get_full_path())
return render(request, return render(request,
'bulk_special_schedules_intermediate.html', 'bulk_special_schedules_intermediate.html',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment