blob: 1bca1b90ddf214a058483f5dbd4293786818efb4 [file] [log] [blame]
Siobhan Tully4bc09f22013-04-10 21:15:21 -04001import os
2from django.db import models
Siobhan Tully30fd4292013-05-10 08:59:56 -04003from core.models import PlCoreBase
Tony Mackbf39d9f2014-05-06 21:42:36 -04004from core.models import Deployment
Sapan Bhatiaa828b7e2014-09-22 15:08:09 -04005from core.models import Deployment,DeploymentLinkManager,DeploymentLinkDeletionManager
Siobhan Tully4bc09f22013-04-10 21:15:21 -04006
7# Create your models here.
8
9class Image(PlCoreBase):
Siobhan Tully4bc09f22013-04-10 21:15:21 -040010 name = models.CharField(max_length=256, unique=True)
11 disk_format = models.CharField(max_length=256)
12 container_format = models.CharField(max_length=256)
Tony Mackbf39d9f2014-05-06 21:42:36 -040013 path = models.CharField(max_length=256, null=True, blank=True, help_text="Path to image on local disk")
Siobhan Tully4bc09f22013-04-10 21:15:21 -040014
15 def __unicode__(self): return u'%s' % (self.name)
Tony Mackbf39d9f2014-05-06 21:42:36 -040016
Sapan Bhatiab19c22a2014-11-11 23:05:53 -050017class ImageDeployment(PlCoreBase):
Sapan Bhatiaa828b7e2014-09-22 15:08:09 -040018 objects = DeploymentLinkManager()
19 deleted_objects = DeploymentLinkDeletionManager()
Sapan Bhatia14356b72014-11-05 10:32:41 -050020 image = models.ForeignKey(Image,related_name='imagedeployments')
21 deployment = models.ForeignKey(Deployment,related_name='imagedeployments')
Tony Mackbf39d9f2014-05-06 21:42:36 -040022 glance_image_id = models.CharField(null=True, blank=True, max_length=200, help_text="Glance image id")
23
24 def __unicode__(self): return u'%s %s' % (self.image, self.deployment)
25
26