From fee069628d000508360b179e48dcb21e0e64a9f2 Mon Sep 17 00:00:00 2001 From: deathowl Date: Tue, 10 Nov 2015 03:40:44 +0100 Subject: [PATCH] fix issue #42 --- openduty/services.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openduty/services.py b/openduty/services.py index 37ec91f..7bfb5ae 100644 --- a/openduty/services.py +++ b/openduty/services.py @@ -68,7 +68,11 @@ def new(request): def save(request): # Update service fields try: - service = Service.objects.get(id = request.POST['id']) + service_id = request.POST.get("id") + if service_id != '0': + service = Service.objects.get(id=service_id) + else: + service = Service() except Service.DoesNotExist: service = Service()