blob: 328a2ba93c78cdee6816c1b4822a4007888aaf6a [file] [log] [blame]
Scott Baker2c3cb642014-05-19 17:55:56 -07001import os
2from django.db import models
Scott Baker59248182015-02-17 13:34:32 -08003from core.models import PlCoreBase, Controller, Deployment
Scott Baker786a9c12014-12-19 16:41:12 -08004from core.models.site import ControllerLinkManager, ControllerLinkDeletionManager
Scott Baker2c3cb642014-05-19 17:55:56 -07005from django.contrib.contenttypes import generic
6
7class DashboardView(PlCoreBase):
8 name = models.CharField(max_length=200, unique=True, help_text="Name of the View")
9 url = models.CharField(max_length=1024, help_text="URL of Dashboard")
Scott Bakerd2ab6c52014-12-22 17:43:25 -080010 controllers = models.ManyToManyField(Controller, blank=True, related_name="dashboardviews", through='ControllerDashboardView')
Scott Bakerc15ad1b2015-01-18 16:33:30 -080011 enabled = models.BooleanField(default=True)
Scott Baker59248182015-02-17 13:34:32 -080012 deployments = models.ManyToManyField(Deployment, blank=True, null=True, related_name="dashboardviews", help_text="Deployments that should be included in this view")
Scott Baker2c3cb642014-05-19 17:55:56 -070013
14 def __unicode__(self): return u'%s' % (self.name)
15
Scott Bakerf2c0c512014-12-22 17:35:34 -080016class ControllerDashboardView(PlCoreBase):
Scott Baker786a9c12014-12-19 16:41:12 -080017 objects = ControllerLinkManager()
18 deleted_objects = ControllerLinkDeletionManager()
Scott Bakerc04e1422014-12-23 09:39:06 -080019 controller = models.ForeignKey(Controller, related_name='controllerdashboardviews')
20 dashboardView = models.ForeignKey(DashboardView, related_name='controllerdashboardviews')
Scott Bakerc15ad1b2015-01-18 16:33:30 -080021 enabled = models.BooleanField(default=True)
Scott Baker786a9c12014-12-19 16:41:12 -080022
23 url = models.CharField(max_length=1024, help_text="URL of Dashboard")
24
25
26