Scott Baker | 2c3cb64 | 2014-05-19 17:55:56 -0700 | [diff] [blame] | 1 | import os |
| 2 | from django.db import models |
Scott Baker | 5924818 | 2015-02-17 13:34:32 -0800 | [diff] [blame^] | 3 | from core.models import PlCoreBase, Controller, Deployment |
Scott Baker | 786a9c1 | 2014-12-19 16:41:12 -0800 | [diff] [blame] | 4 | from core.models.site import ControllerLinkManager, ControllerLinkDeletionManager |
Scott Baker | 2c3cb64 | 2014-05-19 17:55:56 -0700 | [diff] [blame] | 5 | from django.contrib.contenttypes import generic |
| 6 | |
| 7 | class 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 Baker | d2ab6c5 | 2014-12-22 17:43:25 -0800 | [diff] [blame] | 10 | controllers = models.ManyToManyField(Controller, blank=True, related_name="dashboardviews", through='ControllerDashboardView') |
Scott Baker | c15ad1b | 2015-01-18 16:33:30 -0800 | [diff] [blame] | 11 | enabled = models.BooleanField(default=True) |
Scott Baker | 5924818 | 2015-02-17 13:34:32 -0800 | [diff] [blame^] | 12 | deployments = models.ManyToManyField(Deployment, blank=True, null=True, related_name="dashboardviews", help_text="Deployments that should be included in this view") |
Scott Baker | 2c3cb64 | 2014-05-19 17:55:56 -0700 | [diff] [blame] | 13 | |
| 14 | def __unicode__(self): return u'%s' % (self.name) |
| 15 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 16 | class ControllerDashboardView(PlCoreBase): |
Scott Baker | 786a9c1 | 2014-12-19 16:41:12 -0800 | [diff] [blame] | 17 | objects = ControllerLinkManager() |
| 18 | deleted_objects = ControllerLinkDeletionManager() |
Scott Baker | c04e142 | 2014-12-23 09:39:06 -0800 | [diff] [blame] | 19 | controller = models.ForeignKey(Controller, related_name='controllerdashboardviews') |
| 20 | dashboardView = models.ForeignKey(DashboardView, related_name='controllerdashboardviews') |
Scott Baker | c15ad1b | 2015-01-18 16:33:30 -0800 | [diff] [blame] | 21 | enabled = models.BooleanField(default=True) |
Scott Baker | 786a9c1 | 2014-12-19 16:41:12 -0800 | [diff] [blame] | 22 | |
| 23 | url = models.CharField(max_length=1024, help_text="URL of Dashboard") |
| 24 | |
| 25 | |
| 26 | |