blob: 84a5427bee2a4317f096bfc9776db494a49a97eb [file] [log] [blame]
Scott Baker37b47902014-09-02 14:37:41 -07001import os
2import socket
3from django.db import models
Scott Baker7a61dc42014-09-02 17:08:20 -07004from core.models import PlCoreBase, Deployment
Scott Baker37b47902014-09-02 14:37:41 -07005from django.contrib.contenttypes.models import ContentType
6from django.contrib.contenttypes import generic
7
8class 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
22 @staticmethod
23 def select_by_user(user):
24 return Flavor.objects.all()
25
26""" FlavorParameterType and FlavorParameter are below for completeness sake,
27 waiting for the day we might want to add parameters to flavors.
28
29class FlavorParameterType(PlCoreBase):
30 name = models.SlugField(help_text="The name of this parameter", max_length=128)
31 description = models.CharField(max_length=1024)
32
33 def __unicode__(self): return u'%s' % (self.name)
34
35class FlavorParameter(PlCoreBase):
36 parameter = models.ForeignKey(FlavorParameterType, related_name="parameters", help_text="The type of the parameter")
37 value = models.CharField(help_text="The value of this parameter", max_length=1024)
38
39 flavor = models.ForeignKey(Flavor)
40
41 def __unicode__(self):
42 return self.parameter.name
43
44"""
45