コード例 #1
0
ファイル: plans.py プロジェクト: Dynamicic/silver
class MeteredFeature(models.Model):
    name = models.CharField(
        max_length=200,
        help_text='The feature display name.',
        db_index=True,
    )
    unit = models.CharField(max_length=20)
    price_per_unit = models.DecimalField(
        max_digits=19, decimal_places=4, validators=[MinValueValidator(0.0)],
        help_text='The price per unit.',
    )

    # LinkedFeaturesFeature
    included_units = models.DecimalField(
        max_digits=19, decimal_places=4, validators=[MinValueValidator(0.0)],
        help_text='The number of included units per plan interval.'
    )
    # PrebilledMeteredFeature
    prebill_included_units = models.NullBooleanField(
        help_text="If this is set to True, then the total of included units will be "
                  "pre-billed at the beginning of the cycle."
    )

    included_units_during_trial = models.DecimalField(
        max_digits=19, decimal_places=4, validators=[MinValueValidator(0.0)],
        blank=True, null=True,
        help_text='The number of included units during the trial period.'
    )
    product_code = UnsavedForeignKey(
        'ProductCode', help_text='The product code for this plan.'
    )

    linked_feature = UnsavedForeignKey(
        'self', null=True, blank=True, help_text="A related feature."
    )

    included_units_calculation = models.CharField(
        max_length=200, null=True, blank=True,
        help_text='A formula to calculate included units.'
    )

    class Meta:
        ordering = ('name',)

    def __str__(self):
        fmt = u'{name} ({price:.2f}$, {included:.2f} included)'
        return fmt.format(name=self.name, price=self.price_per_unit,
                          included=self.included_units)
コード例 #2
0
class MeteredFeature(models.Model):
    name = models.CharField(
        max_length=200,
        help_text='The feature display name.',
        db_index=True,
    )
    unit = models.CharField(max_length=20)
    price_per_unit = models.DecimalField(
        max_digits=19, decimal_places=4, validators=[MinValueValidator(0.0)],
        help_text='The price per unit.',
    )
    included_units = models.DecimalField(
        max_digits=19, decimal_places=4, validators=[MinValueValidator(0.0)],
        help_text='The number of included units per plan interval.'
    )
    included_units_during_trial = models.DecimalField(
        max_digits=19, decimal_places=4, validators=[MinValueValidator(0.0)],
        blank=True, null=True,
        help_text='The number of included units during the trial period.'
    )
    product_code = UnsavedForeignKey(
        'ProductCode', help_text='The product code for this plan.'
    )

    class Meta:
        ordering = ('name',)

    def __unicode__(self):
        fmt = u'{name} ({price:.2f}$, {included:.2f} included)'
        return fmt.format(name=self.name, price=self.price_per_unit,
                          included=self.included_units)
コード例 #3
0
class MeteredFeature(models.Model):
    region = models.CharField(
        max_length=200,
        help_text='Please enter Region name',
        blank=True,
        null=True,
    )

    ostype = models.CharField(
        max_length=200,
        help_text='Please enter OS Type',
        blank=True,
        null=True,
    )

    name = models.CharField(
        max_length=200,
        help_text='The feature display name.',
        db_index=True,
    )
    unit = models.CharField(max_length=20)
    price_per_unit = models.DecimalField(
        max_digits=19,
        decimal_places=4,
        validators=[MinValueValidator(0.0)],
        help_text='The price per unit.',
    )
    included_units = models.DecimalField(
        max_digits=19,
        decimal_places=4,
        validators=[MinValueValidator(0.0)],
        help_text='The number of included units per plan interval.')
    included_units_during_trial = models.DecimalField(
        max_digits=19,
        decimal_places=4,
        validators=[MinValueValidator(0.0)],
        blank=True,
        null=True,
        help_text='The number of included units during the trial period.')

    EBS_volume = models.IntegerField(
        help_text='Please enter EBS Volume ',
        blank=True,
        null=True,
    )

    Elastic_IP = models.CharField(
        max_length=200,
        help_text='Please enter Elastic IP',
        blank=True,
        null=True,
    )

    termstype = models.CharField(
        max_length=200,
        help_text='Please enter Termstype',
        blank=True,
        null=True,
    )

    PriceDescription = models.TextField(blank=True, null=True)
    EffectiveDate = models.CharField(
        max_length=200,
        help_text='EffectiveDate',
        blank=True,
        null=True,
    )
    currency = models.CharField(
        max_length=200,
        help_text='Please enter currency',
        blank=True,
        null=True,
    )
    LeaseContractLength = models.CharField(
        max_length=200,
        help_text='Please enter LeaseContractLength',
        blank=True,
        null=True,
    )

    PurchaseOption = models.CharField(
        max_length=200,
        help_text='Please enter PurchaseOption',
        blank=True,
        null=True,
    )

    OfferingClass = models.CharField(
        max_length=200,
        help_text='Please enter OfferingClass',
        blank=True,
        null=True,
    )

    Product_Family = models.CharField(
        max_length=200,
        help_text='Please enter Product Family',
        blank=True,
        null=True,
    )

    serviceCode = models.CharField(
        max_length=200,
        help_text='Please enter serviceCode',
        blank=True,
        null=True,
    )

    Location_Type = models.CharField(
        max_length=200,
        help_text='Please enter Location Type',
        blank=True,
        null=True,
    )

    Instance_Type = models.CharField(
        max_length=200,
        help_text='Please enter Instance Type',
        blank=True,
        null=True,
    )

    Current_Generation = models.CharField(
        max_length=200,
        help_text='Please enter Current Generation',
        blank=True,
        null=True,
    )
    Instance_Family = models.CharField(
        max_length=200,
        help_text='Please enter Instance Family',
        blank=True,
        null=True,
    )
    vCPU = models.CharField(
        max_length=200,
        help_text='Please enter vCPU',
        blank=True,
        null=True,
    )

    Physical_Processor = models.CharField(
        max_length=200,
        help_text='Please enter Physical Processor',
        blank=True,
        null=True,
    )
    Clock_Speed = models.CharField(
        max_length=200,
        help_text='Please enter Clock Speed',
        blank=True,
        null=True,
    )

    Memory = models.CharField(
        max_length=200,
        help_text='Please enter Memory',
        blank=True,
        null=True,
    )

    Storage = models.CharField(
        max_length=200,
        help_text='Please enter Storage',
        blank=True,
        null=True,
    )

    Network_Performance = models.CharField(
        max_length=200,
        help_text='Please enter Network Performance',
        blank=True,
        null=True,
    )
    Processor_Architecture = models.CharField(
        max_length=200,
        help_text='Please enter Processor Architecture',
        blank=True,
        null=True,
    )
    Storage_Media = models.CharField(
        max_length=200,
        help_text='Please enter Storage Media',
        blank=True,
        null=True,
    )

    Volume_Type = models.CharField(
        max_length=200,
        help_text='Please enter Volume Type',
        blank=True,
        null=True,
    )

    Max_Volume_Size = models.CharField(
        max_length=200,
        help_text='Please enter Max Volume Size',
        blank=True,
        null=True,
    )

    Max_IOPS_volume = models.CharField(
        max_length=200,
        help_text='Please enter Max IOPS_volume',
        blank=True,
        null=True,
    )

    Max_IOPS_Burst_Performance = models.CharField(
        max_length=200,
        help_text='Please enter Max_IOPS_Burst_Performance',
        blank=True,
        null=True,
    )

    Max_throughput_volume = models.CharField(
        max_length=200,
        help_text='Please enter Max_throughput_volume',
        blank=True,
        null=True,
    )
    Provisioned = models.CharField(
        max_length=200,
        help_text='Please enter Provisioned',
        blank=True,
        null=True,
    )

    Tenancy = models.CharField(
        max_length=200,
        help_text='Please enter Tenancy',
        blank=True,
        null=True,
    )

    EBS_Optimized = models.CharField(
        max_length=200,
        help_text='Please enter EBS_Optimize',
        blank=True,
        null=True,
    )

    Operating_System = models.CharField(
        max_length=200,
        help_text='Please enter Operating_System',
        blank=True,
        null=True,
    )
    License_Model = models.CharField(
        max_length=200,
        help_text='Please enter License_Model',
        blank=True,
        null=True,
    )

    Group = models.CharField(
        max_length=200,
        help_text='Please enter Group',
        blank=True,
        null=True,
    )

    Group_Description = models.CharField(
        max_length=200,
        help_text='Please enter Group_Description',
        blank=True,
        null=True,
    )

    Transfer_Type = models.CharField(
        max_length=200,
        help_text='Please enter Transfer_Type',
        blank=True,
        null=True,
    )
    From_Location = models.CharField(
        max_length=200,
        help_text='Please enter From_Location',
        blank=True,
        null=True,
    )
    From_Location_Type = models.CharField(
        max_length=200,
        help_text='Please enter From_Location_Type',
        blank=True,
        null=True,
    )

    To_Location = models.CharField(
        max_length=200,
        help_text='Please enter To_Location',
        blank=True,
        null=True,
    )

    To_Location_Type = models.CharField(
        max_length=200,
        help_text='Please enter To_Location_Type',
        blank=True,
        null=True,
    )

    usageType = models.CharField(
        max_length=200,
        help_text='Please enter usageType',
        blank=True,
        null=True,
    )

    operation = models.CharField(
        max_length=200,
        help_text='Please enter operation',
        blank=True,
        null=True,
    )
    Dedicated_EBS_Throughput = models.CharField(
        max_length=200,
        help_text='Please enter Dedicated_EBS_Throughput',
        blank=True,
        null=True,
    )

    Enhanced_Networking_Supported = models.CharField(
        max_length=200,
        help_text='Please enter Enhanced_Networking_Supported',
        blank=True,
        null=True,
    )
    GPU = models.CharField(
        max_length=200,
        help_text='Please enter GPU',
        blank=True,
        null=True,
    )
    Instance_Capacity_10xlarge = models.CharField(
        max_length=200,
        help_text='Please enter Instance Capacity_10xlarge',
        blank=True,
        null=True,
    )

    Instance_Capacity_2xlarge = models.CharField(
        max_length=200,
        help_text='Please enter Instance_Capacity_2xlarge',
        blank=True,
        null=True,
    )
    Instance_Capacity_4xlarge = models.CharField(
        max_length=200,
        help_text='Please enter Instance_Capacity_4xlarge',
        blank=True,
        null=True,
    )
    Instance_Capacity_8xlarge = models.CharField(
        max_length=200,
        help_text='Please enter Instance_Capacity_8xlarge',
        blank=True,
        null=True,
    )

    Instance_Capacity_large = models.CharField(
        max_length=200,
        help_text='Please enter Instance_Capacity_large',
        blank=True,
        null=True,
    )

    Instance_Capacity_medium = models.CharField(
        max_length=200,
        help_text='Please enter Instance_Capacity_medium',
        blank=True,
        null=True,
    )
    Instance_Capacity_xlarge = models.CharField(
        max_length=200,
        help_text='Please enter Instance_Capacity_xlarge',
        blank=True,
        null=True,
    )
    Intel_AVX_Available = models.CharField(
        max_length=200,
        help_text='Please enter Intel_AVX_Available',
        blank=True,
        null=True,
    )

    Intel_AVX2_Available = models.CharField(
        max_length=200,
        help_text='Please enter Intel_AVX2_Available',
        blank=True,
        null=True,
    )

    Intel_Turbo_Available = models.CharField(
        max_length=200,
        help_text='Please enter Intel_Turbo_Available',
        blank=True,
        null=True,
    )
    Physical_Cores = models.CharField(
        max_length=200,
        help_text='Please enter Physical_Cores',
        blank=True,
        null=True,
    )
    Pre_Installed_SW = models.CharField(
        max_length=200,
        help_text='Please enter Pre_Installed_SW',
        blank=True,
        null=True,
    )

    Processor_Features = models.CharField(
        max_length=200,
        help_text='Please enter Processor_Features',
        blank=True,
        null=True,
    )

    Sockets = models.CharField(
        max_length=200,
        help_text='Please enter Sockets',
        blank=True,
        null=True,
    )

    product_code = UnsavedForeignKey(
        'ProductCode', help_text='The product code for this plan.')

    class Meta:
        ordering = ('name', )

    def __unicode__(self):
        fmt = u'{name} ({ostype},{price_per_unit},{PriceDescription})'
        return fmt.format(name=self.name,
                          price_per_unit=self.price_per_unit,
                          ostype=self.ostype,
                          PriceDescription=self.PriceDescription)