diff options
author | Parker Berberian <pberberian@iol.unh.edu> | 2019-06-21 15:12:04 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2019-06-21 15:12:04 +0000 |
commit | 46f31a6df95a4d071ef49acf5a1dfb3ceecf0ea3 (patch) | |
tree | 41607a462e02d40b9e83a3f88cdd85a1ba70b774 /src/booking | |
parent | 16e270ab8a432e98e556488a2d593724a1dea12d (diff) | |
parent | c9c1f4a579636598cd61dce5c199003c3633b349 (diff) |
Merge "Fix quick booking redirect"
Diffstat (limited to 'src/booking')
-rw-r--r-- | src/booking/quick_deployer.py | 2 | ||||
-rw-r--r-- | src/booking/views.py | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/booking/quick_deployer.py b/src/booking/quick_deployer.py index 11f5437..0e0cc5a 100644 --- a/src/booking/quick_deployer.py +++ b/src/booking/quick_deployer.py @@ -326,6 +326,8 @@ def create_from_form(form, request): JobFactory.makeCompleteJob(booking) NotificationHandler.notify_new_booking(booking) + return booking + def drop_filter(user): installer_filter = {} diff --git a/src/booking/views.py b/src/booking/views.py index 13e9d01..bad7dc9 100644 --- a/src/booking/views.py +++ b/src/booking/views.py @@ -16,6 +16,7 @@ from django.views import View from django.views.generic import TemplateView from django.shortcuts import redirect, render from django.db.models import Q +from django.urls import reverse from resource_inventory.models import ResourceBundle, HostProfile, Image, Host from resource_inventory.resource_manager import ResourceManager @@ -60,14 +61,13 @@ def quick_create(request): if form.is_valid(): try: - create_from_form(form, request) + booking = create_from_form(form, request) + messages.success(request, "We've processed your request. " + "Check Account->My Bookings for the status of your new booking") + return redirect(reverse('booking:booking_detail', kwargs={'booking_id': booking.id})) except Exception as e: messages.error(request, "Whoops, an error occurred: " + str(e)) - return render(request, 'workflow/exit_redirect.html', context) - - messages.success(request, "We've processed your request. " - "Check Account->My Bookings for the status of your new booking") - return render(request, 'workflow/exit_redirect.html', context) + return render(request, 'booking/quick_deploy.html', context) else: messages.error(request, "Looks like the form didn't validate. Check that you entered everything correctly") return render(request, 'booking/quick_deploy.html', context) |