blob: 9f5f165f85989da566c02155be347a9094b0d60e [file] [log] [blame]
Siobhan Tullybfd11dc2013-09-03 12:59:24 -04001from django.db import models
Siobhan Tullycf04fb62014-01-11 11:25:57 -05002from core.models import User, Service, SingletonModel, PlCoreBase
Siobhan Tullybfd11dc2013-09-03 12:59:24 -04003import os
4from django.db import models
5from django.forms.models import model_to_dict
6
7
8# Create your models here.
9
Siobhan Tullycf04fb62014-01-11 11:25:57 -050010class HpcService(SingletonModel,Service):
Siobhan Tullybfd11dc2013-09-03 12:59:24 -040011
12 class Meta:
Siobhan Tullybfd11dc2013-09-03 12:59:24 -040013 app_label = "hpc"
Siobhan Tullycf04fb62014-01-11 11:25:57 -050014 verbose_name = "HPC Service"
Siobhan Tullybfd11dc2013-09-03 12:59:24 -040015
Siobhan Tullycf04fb62014-01-11 11:25:57 -050016class ServiceProvider(PlCoreBase):
17 class Meta:
18 app_label = "hpc"
Scott Bakere728c892014-01-12 11:41:09 -080019
20 service_provider_id = models.IntegerField(null=True, blank=True)
Siobhan Tullybfd11dc2013-09-03 12:59:24 -040021 name = models.CharField(max_length=254,help_text="Service Provider Name")
22 description = models.TextField(max_length=254,null=True, blank=True, help_text="Description of Service Provider")
23 enabled = models.BooleanField(default=True)
24
25 def __unicode__(self): return u'%s' % (self.name)
26
Siobhan Tullycf04fb62014-01-11 11:25:57 -050027class ContentProvider(PlCoreBase):
28 class Meta:
29 app_label = "hpc"
Scott Bakere728c892014-01-12 11:41:09 -080030
31 content_provider_id = models.IntegerField(null=True, blank=True)
Siobhan Tullybfd11dc2013-09-03 12:59:24 -040032 name = models.CharField(max_length=254)
33 enabled = models.BooleanField(default=True)
34 description = models.TextField(max_length=254,null=True, blank=True,help_text="Description of Content Provider")
35 serviceProvider = models.ForeignKey(ServiceProvider)
36
37 # Note user relationships are directed not requiring a role.
38 users = models.ManyToManyField(User)
39
40 def __unicode__(self): return u'%s' % (self.name)
41
Siobhan Tullycf04fb62014-01-11 11:25:57 -050042class OriginServer(PlCoreBase):
43 class Meta:
44 app_label = "hpc"
Scott Bakere728c892014-01-12 11:41:09 -080045
46 origin_server_id = models.IntegerField(null=True, blank=True)
Siobhan Tullybfd11dc2013-09-03 12:59:24 -040047 url = models.URLField()
48 contentProvider = models.ForeignKey(ContentProvider)
49
50 authenticated = models.BooleanField(default=False, help_text="Status for this Site")
51 enabled = models.BooleanField(default=True, help_text="Status for this Site")
52 PROTOCOL_CHOICES = (('http', 'HTTP'),('rtmp', 'RTMP'), ('rtp', 'RTP'),('shout', 'SHOUTcast'))
53 protocol = models.CharField(default="HTTP", max_length = 12, choices=PROTOCOL_CHOICES)
54 redirects = models.BooleanField(default=True, help_text="Indicates whether Origin Server redirects should be used for this Origin Server")
55 description = models.TextField(null=True, blank=True, max_length=255)
56
57 def __unicode__(self): return u'%s' % (self.url)
58
Siobhan Tullycf04fb62014-01-11 11:25:57 -050059class CDNPrefix(PlCoreBase):
60 class Meta:
61 app_label = "hpc"
Scott Bakere728c892014-01-12 11:41:09 -080062
63 cdn_prefix_id = models.IntegerField(null=True, blank=True)
Siobhan Tullybfd11dc2013-09-03 12:59:24 -040064 prefix = models.CharField(max_length=200, help_text="Registered Prefix for Domain")
65 contentProvider = models.ForeignKey(ContentProvider)
66 description = models.TextField(max_length=254,null=True, blank=True,help_text="Description of Content Provider")
67
68 defaultOriginServer = models.ForeignKey(OriginServer)
69 enabled = models.BooleanField(default=True)
70
71 def __unicode__(self): return u'%s' % (self.prefix)
72