diff options
author | maxbr <maxbr@mi.fu-berlin.de> | 2016-09-12 11:18:10 +0200 |
---|---|---|
committer | maxbr <maxbr@mi.fu-berlin.de> | 2016-09-12 11:18:10 +0200 |
commit | c19db1ed0fcbf232a7a9045e8d5680b93929dddd (patch) | |
tree | 2e100b7736ccd430a2328f42dbbbbf75aa78dd77 /pharos-dashboard/booking/views.py | |
parent | 7c5fb4bcc0f291bc0d9563545a2a7112084d5b26 (diff) |
Add info to the resource view
JIRA: PHAROS-266
This adds a panel containing lab owner contact information, jenkins
utilization timerange options and a table containing vpn users of a pod
to the resource view.
Change-Id: If991c74d3c93cd08f622771acc048ab998e16c48
Signed-off-by: maxbr <maxbr@mi.fu-berlin.de>
Diffstat (limited to 'pharos-dashboard/booking/views.py')
-rw-r--r-- | pharos-dashboard/booking/views.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pharos-dashboard/booking/views.py b/pharos-dashboard/booking/views.py index fde8d81..d0b2aef 100644 --- a/pharos-dashboard/booking/views.py +++ b/pharos-dashboard/booking/views.py @@ -1,9 +1,13 @@ +from datetime import timedelta + +from django.conf import settings from django.contrib import messages from django.contrib.auth.mixins import LoginRequiredMixin from django.http import JsonResponse from django.shortcuts import get_object_or_404 from django.shortcuts import redirect from django.urls import reverse +from django.utils import timezone from django.views import View from django.views.generic import FormView from django.views.generic import TemplateView @@ -67,7 +71,8 @@ class BookingFormView(LoginRequiredMixin, FormView): messages.add_message(self.request, messages.ERROR, err) return super(BookingFormView, self).form_invalid(form) try: - create_jira_ticket(user, booking) + if settings.CREATE_JIRA_TICKET: + create_jira_ticket(user, booking) except JIRAError: messages.add_message(self.request, messages.ERROR, 'Failed to create Jira Ticket. ' 'Please check your Jira ' @@ -93,5 +98,6 @@ class BookingView(TemplateView): class ResourceBookingsJSON(View): def get(self, request, *args, **kwargs): resource = get_object_or_404(Resource, id=self.kwargs['resource_id']) - bookings = resource.booking_set.get_queryset().values('id', 'start', 'end', 'purpose') - return JsonResponse({'bookings': list(bookings)}) + bookings = resource.booking_set.get_queryset().values('id', 'start', 'end', 'purpose', + 'jira_issue_status') + return JsonResponse({'bookings': list(bookings)})
\ No newline at end of file |