|
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
|
|
|
|
|
import datetime
|
|
|
|
|
|
+from django.conf import settings
|
|
|
from django.db import models
|
|
|
from django.db.models import Q
|
|
|
from django.core.validators import MinValueValidator
|
|
@@ -19,6 +20,9 @@ class Offer(models.Model):
|
|
|
|
|
|
name = models.CharField(max_length=255, blank=False, null=False,
|
|
|
verbose_name="nom de l'offre")
|
|
|
+ reference = models.CharField(max_length=255, blank=True,
|
|
|
+ verbose_name="référence de l'offre",
|
|
|
+ help_text="Identifiant a utiliser par exemple comme identifiant de virement")
|
|
|
configuration_type = models.CharField(max_length=50,
|
|
|
blank=True,
|
|
|
verbose_name='type de configuration',
|
|
@@ -103,6 +107,10 @@ class OfferSubscription(models.Model):
|
|
|
member = models.ForeignKey('members.Member', verbose_name='membre')
|
|
|
offer = models.ForeignKey('Offer', verbose_name='offre')
|
|
|
|
|
|
+ def get_subscription_reference(self):
|
|
|
+ return settings.SUBSCRIPTION_REFERENCE.format(subscription=self)
|
|
|
+ get_subscription_reference.short_description = 'Référence'
|
|
|
+
|
|
|
def __unicode__(self):
|
|
|
return '%s - %s - %s' % (self.member, self.offer.name,
|
|
|
self.subscription_date)
|