2018-08-31 14:46:35 +02:00
|
|
|
from django.db import models
|
2018-11-27 09:07:12 +01:00
|
|
|
from simple_history.models import HistoricalRecords
|
|
|
|
from django.core.validators import MinValueValidator
|
|
|
|
|
2018-08-31 14:46:35 +02:00
|
|
|
|
|
|
|
class PaymentMethod(models.Model):
|
2018-12-02 16:28:40 +01:00
|
|
|
"""
|
|
|
|
Stores payment methods
|
|
|
|
"""
|
2018-10-06 00:03:02 +02:00
|
|
|
name = models.CharField(max_length=255, verbose_name="Nom")
|
|
|
|
is_active = models.BooleanField(default=True, verbose_name="Actif")
|
2018-11-22 22:52:15 +01:00
|
|
|
is_usable_in_cotisation = models.BooleanField(default=True, verbose_name="Cotisations ?")
|
|
|
|
is_usable_in_reload = models.BooleanField(default=True, verbose_name="Rechargements ?")
|
2018-10-06 00:03:02 +02:00
|
|
|
affect_balance = models.BooleanField(default=False, verbose_name="Affecte le solde")
|
2019-01-06 05:18:31 +01:00
|
|
|
icon = models.CharField(max_length=255, verbose_name="Icône", blank=True)
|
2018-11-27 09:07:12 +01:00
|
|
|
history = HistoricalRecords()
|
2018-08-31 14:46:35 +02:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
class GeneralPreferences(models.Model):
|
2018-12-02 16:28:40 +01:00
|
|
|
"""
|
|
|
|
Stores a unique line of general preferences
|
|
|
|
"""
|
2018-08-31 14:46:35 +02:00
|
|
|
is_active = models.BooleanField(default=True)
|
|
|
|
active_message = models.TextField(blank=True)
|
|
|
|
global_message = models.TextField(blank=True)
|
|
|
|
president = models.CharField(max_length=255, blank=True)
|
|
|
|
vice_president = models.CharField(max_length=255, blank=True)
|
|
|
|
treasurer = models.CharField(max_length=255, blank=True)
|
|
|
|
secretary = models.CharField(max_length=255, blank=True)
|
|
|
|
brewer = models.CharField(max_length=255, blank=True)
|
|
|
|
grocer = models.CharField(max_length=255, blank=True)
|
2018-12-21 21:54:39 +01:00
|
|
|
use_pinte_monitoring = models.BooleanField(default=False)
|
2018-12-23 18:52:18 +01:00
|
|
|
lost_pintes_allowed = models.PositiveIntegerField(default=0)
|
2019-01-06 05:18:31 +01:00
|
|
|
floating_buttons = models.BooleanField(default=False)
|
2018-11-27 09:07:12 +01:00
|
|
|
history = HistoricalRecords()
|
2018-10-06 00:03:02 +02:00
|
|
|
|
|
|
|
class Cotisation(models.Model):
|
2018-12-02 16:28:40 +01:00
|
|
|
"""
|
|
|
|
Stores cotisations
|
|
|
|
"""
|
2018-11-27 09:07:12 +01:00
|
|
|
amount = models.DecimalField(max_digits=5, decimal_places=2, null=True, verbose_name="Montant", validators=[MinValueValidator(0)])
|
2018-10-06 00:03:02 +02:00
|
|
|
duration = models.PositiveIntegerField(verbose_name="Durée de la cotisation (jours)")
|
2018-11-27 09:07:12 +01:00
|
|
|
history = HistoricalRecords()
|
2018-10-06 00:03:02 +02:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return "Cotisation de " + str(self.duration) + " jours pour le prix de " + str(self.amount) + "€"
|