Scott Baker | 2c3cb64 | 2014-05-19 17:55:56 -0700 | [diff] [blame] | 1 | import os |
| 2 | from django.db import models |
Scott Baker | eef5a6b | 2014-12-19 16:41:12 -0800 | [diff] [blame] | 3 | from core.models import PlCoreBase, Controller |
| 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 | 75930d8 | 2014-12-22 17:43:25 -0800 | [diff] [blame] | 10 | controllers = models.ManyToManyField(Controller, blank=True, related_name="dashboardviews", through='ControllerDashboardView') |
Scott Baker | b8f3cab | 2015-01-18 16:33:30 -0800 | [diff] [blame] | 11 | enabled = models.BooleanField(default=True) |
Scott Baker | 2c3cb64 | 2014-05-19 17:55:56 -0700 | [diff] [blame] | 12 | |
| 13 | def __unicode__(self): return u'%s' % (self.name) |
| 14 | |
Scott Baker | a6a0c77 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 15 | class ControllerDashboardView(PlCoreBase): |
Scott Baker | eef5a6b | 2014-12-19 16:41:12 -0800 | [diff] [blame] | 16 | objects = ControllerLinkManager() |
| 17 | deleted_objects = ControllerLinkDeletionManager() |
Scott Baker | f0f5073 | 2014-12-23 09:39:06 -0800 | [diff] [blame] | 18 | controller = models.ForeignKey(Controller, related_name='controllerdashboardviews') |
| 19 | dashboardView = models.ForeignKey(DashboardView, related_name='controllerdashboardviews') |
Scott Baker | b8f3cab | 2015-01-18 16:33:30 -0800 | [diff] [blame] | 20 | enabled = models.BooleanField(default=True) |
Scott Baker | eef5a6b | 2014-12-19 16:41:12 -0800 | [diff] [blame] | 21 | |
| 22 | url = models.CharField(max_length=1024, help_text="URL of Dashboard") |
| 23 | |
| 24 | |
| 25 | |