Make recurring period a database model

- For easier handling (foreignkeys, many2many)
- For higher flexibility (users can define their own periods)
This commit is contained in:
Nico Schottelius 2020-10-06 15:46:22 +02:00
commit 992c7c551e
11 changed files with 588 additions and 362 deletions

View file

@ -71,12 +71,12 @@ class VMProduct(models.Model):
return "Virtual machine '{}': {} core(s), {}GB memory".format(
self.name, self.cores, self.ram_in_gb)
@staticmethod
def allowed_recurring_periods():
return list(filter(
lambda pair: pair[0] in [RecurringPeriod.PER_365D,
RecurringPeriod.PER_30D, RecurringPeriod.PER_HOUR],
RecurringPeriod.choices))
# @staticmethod
# def allowed_recurring_periods():
# return list(filter(
# lambda pair: pair[0] in [RecurringPeriod.PER_365D,
# RecurringPeriod.PER_30D, RecurringPeriod.PER_HOUR],
# RecurringPeriod.choices))
def __str__(self):