Siobhan Tully | 4bc09f2 | 2013-04-10 21:15:21 -0400 | [diff] [blame] | 1 | import os |
| 2 | from django.db import models |
Siobhan Tully | 30fd429 | 2013-05-10 08:59:56 -0400 | [diff] [blame] | 3 | from core.models import PlCoreBase |
Tony Mack | bf39d9f | 2014-05-06 21:42:36 -0400 | [diff] [blame] | 4 | from core.models import Deployment |
Sapan Bhatia | a828b7e | 2014-09-22 15:08:09 -0400 | [diff] [blame] | 5 | from core.models import Deployment,DeploymentLinkManager,DeploymentLinkDeletionManager |
Siobhan Tully | 4bc09f2 | 2013-04-10 21:15:21 -0400 | [diff] [blame] | 6 | |
| 7 | # Create your models here. |
| 8 | |
| 9 | class Image(PlCoreBase): |
Siobhan Tully | 4bc09f2 | 2013-04-10 21:15:21 -0400 | [diff] [blame] | 10 | 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 Mack | bf39d9f | 2014-05-06 21:42:36 -0400 | [diff] [blame] | 13 | path = models.CharField(max_length=256, null=True, blank=True, help_text="Path to image on local disk") |
Siobhan Tully | 4bc09f2 | 2013-04-10 21:15:21 -0400 | [diff] [blame] | 14 | |
| 15 | def __unicode__(self): return u'%s' % (self.name) |
Tony Mack | bf39d9f | 2014-05-06 21:42:36 -0400 | [diff] [blame] | 16 | |
Sapan Bhatia | b19c22a | 2014-11-11 23:05:53 -0500 | [diff] [blame] | 17 | class ImageDeployment(PlCoreBase): |
Sapan Bhatia | a828b7e | 2014-09-22 15:08:09 -0400 | [diff] [blame] | 18 | objects = DeploymentLinkManager() |
| 19 | deleted_objects = DeploymentLinkDeletionManager() |
Sapan Bhatia | 14356b7 | 2014-11-05 10:32:41 -0500 | [diff] [blame] | 20 | image = models.ForeignKey(Image,related_name='imagedeployments') |
| 21 | deployment = models.ForeignKey(Deployment,related_name='imagedeployments') |
Tony Mack | bf39d9f | 2014-05-06 21:42:36 -0400 | [diff] [blame] | 22 | 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 | |