Scott Baker | 37b4790 | 2014-09-02 14:37:41 -0700 | [diff] [blame] | 1 | import os |
| 2 | import socket |
| 3 | from django.db import models |
Scott Baker | 7a61dc4 | 2014-09-02 17:08:20 -0700 | [diff] [blame] | 4 | from core.models import PlCoreBase, Deployment |
Scott Baker | 37b4790 | 2014-09-02 14:37:41 -0700 | [diff] [blame] | 5 | from django.contrib.contenttypes.models import ContentType |
| 6 | from django.contrib.contenttypes import generic |
| 7 | |
| 8 | class Flavor(PlCoreBase): |
| 9 | name = models.CharField(max_length=32, help_text="name of this flavor, as displayed to users") |
| 10 | description = models.CharField(max_length=1024, blank=True, null=True) |
| 11 | flavor = models.CharField(max_length=32, help_text="flavor string used to configure deployments") |
| 12 | deployments = models.ManyToManyField(Deployment, blank=True, related_name="flavors") |
| 13 | order = models.IntegerField(default=0, help_text="used to order flavors when displayed in a list") |
| 14 | default = models.BooleanField(default=False, help_text="make this a default flavor to use when creating new instances") |
| 15 | |
| 16 | class Meta: |
| 17 | app_label = "core" |
| 18 | ordering = ('order', 'name') |
| 19 | |
| 20 | def __unicode__(self): return u'%s' % (self.name) |
| 21 | |
Scott Baker | 37b4790 | 2014-09-02 14:37:41 -0700 | [diff] [blame] | 22 | """ FlavorParameterType and FlavorParameter are below for completeness sake, |
| 23 | waiting for the day we might want to add parameters to flavors. |
| 24 | |
| 25 | class FlavorParameterType(PlCoreBase): |
| 26 | name = models.SlugField(help_text="The name of this parameter", max_length=128) |
| 27 | description = models.CharField(max_length=1024) |
| 28 | |
| 29 | def __unicode__(self): return u'%s' % (self.name) |
| 30 | |
| 31 | class FlavorParameter(PlCoreBase): |
Sapan Bhatia | 13d2db9 | 2014-11-11 21:47:45 -0500 | [diff] [blame^] | 32 | parameter = models.ForeignKey(FlavorParameterType, related_name="flavorparameters", help_text="The type of the parameter") |
Scott Baker | 37b4790 | 2014-09-02 14:37:41 -0700 | [diff] [blame] | 33 | value = models.CharField(help_text="The value of this parameter", max_length=1024) |
| 34 | |
Sapan Bhatia | 475c597 | 2014-11-05 10:32:41 -0500 | [diff] [blame] | 35 | flavor = models.ForeignKey(Flavor,related_name='flavorparameter') |
Scott Baker | 37b4790 | 2014-09-02 14:37:41 -0700 | [diff] [blame] | 36 | |
| 37 | def __unicode__(self): |
| 38 | return self.parameter.name |
| 39 | |
| 40 | """ |
| 41 | |