|
@@ -9,6 +9,8 @@ from django.db.models import Count, Q
|
|
|
from django.core.validators import MinValueValidator
|
|
|
from django.contrib.contenttypes.models import ContentType
|
|
|
|
|
|
+from coin.resources.models import IPPool
|
|
|
+
|
|
|
|
|
|
class OfferManager(models.Manager):
|
|
|
def manageable_by(self, user):
|
|
@@ -60,6 +62,8 @@ class Offer(models.Model):
|
|
|
verbose_name='n\'est pas facturable',
|
|
|
help_text='L\'offre ne sera pas facturée par la commande charge_members')
|
|
|
|
|
|
+ ippools = models.ManyToManyField(IPPool, through='OfferIPPool')
|
|
|
+
|
|
|
objects = OfferManager()
|
|
|
|
|
|
def get_configuration_type_display(self):
|
|
@@ -97,6 +101,20 @@ class Offer(models.Model):
|
|
|
verbose_name = 'offre'
|
|
|
|
|
|
|
|
|
+class OfferIPPool(models.Model):
|
|
|
+ offer = models.ForeignKey(Offer,
|
|
|
+ verbose_name='offre')
|
|
|
+ ippool = models.ForeignKey(IPPool,
|
|
|
+ verbose_name='pool d\'IP')
|
|
|
+ to_assign = models.BooleanField(default=False,
|
|
|
+ verbose_name='assignation par défaut')
|
|
|
+
|
|
|
+ class Meta:
|
|
|
+ verbose_name = 'pool d\'IP'
|
|
|
+ verbose_name_plural = "pools d'IP"
|
|
|
+ ordering = ['-to_assign']
|
|
|
+
|
|
|
+
|
|
|
class OfferSubscriptionQuerySet(models.QuerySet):
|
|
|
def running(self, at_date=None):
|
|
|
""" Only the running contracts at a given date.
|