summaryrefslogtreecommitdiffstats
path: root/pharos-dashboard/booking/models.py
diff options
context:
space:
mode:
authormaxbr <maxbr@mi.fu-berlin.de>2016-09-12 11:18:10 +0200
committermaxbr <maxbr@mi.fu-berlin.de>2016-09-12 11:18:10 +0200
commitc19db1ed0fcbf232a7a9045e8d5680b93929dddd (patch)
tree2e100b7736ccd430a2328f42dbbbbf75aa78dd77 /pharos-dashboard/booking/models.py
parent7c5fb4bcc0f291bc0d9563545a2a7112084d5b26 (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/models.py')
-rw-r--r--pharos-dashboard/booking/models.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/pharos-dashboard/booking/models.py b/pharos-dashboard/booking/models.py
index 4be8cca..e772fb5 100644
--- a/pharos-dashboard/booking/models.py
+++ b/pharos-dashboard/booking/models.py
@@ -1,10 +1,10 @@
from django.contrib.auth.models import User
from django.db import models
from jira import JIRA
+from jira import JIRAError
from dashboard.models import Resource
-from pharos_dashboard import settings
-
+from django.conf import settings
class Booking(models.Model):
id = models.AutoField(primary_key=True)
@@ -13,6 +13,7 @@ class Booking(models.Model):
start = models.DateTimeField()
end = models.DateTimeField()
jira_issue_id = models.IntegerField(null=True)
+ jira_issue_status = models.CharField(max_length=50)
purpose = models.CharField(max_length=300, blank=False)
@@ -20,9 +21,13 @@ class Booking(models.Model):
db_table = 'booking'
def get_jira_issue(self):
- jira = JIRA(server=settings.JIRA_URL, basic_auth=(settings.JIRA_USER_NAME, settings.JIRA_USER_PASSWORD))
- issue = jira.issue(self.jira_issue_id)
- return issue
+ try:
+ jira = JIRA(server=settings.JIRA_URL,
+ basic_auth=(settings.JIRA_USER_NAME, settings.JIRA_USER_PASSWORD))
+ issue = jira.issue(self.jira_issue_id)
+ return issue
+ except JIRAError:
+ return None
def authorization_test(self):
"""