8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-27 17:33:45 +00:00
re2o/cotisations/models.py

47 lines
1.5 KiB
Python
Raw Normal View History

2016-07-02 13:58:50 +00:00
from django.db import models
class Facture(models.Model):
user = models.ForeignKey('users.User', on_delete=models.PROTECT)
paiement = models.ForeignKey('Paiement', on_delete=models.PROTECT)
banque = models.ForeignKey('Banque', on_delete=models.PROTECT, blank=True, null=True)
cheque = models.CharField(max_length=255, blank=True)
2016-07-02 13:58:50 +00:00
number = models.IntegerField()
date = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=255)
prix = models.DecimalField(max_digits=5, decimal_places=2)
valid = models.BooleanField(default=True)
2016-07-02 13:58:50 +00:00
def __str__(self):
return str(self.name) + ' ' + str(self.date) + ' ' + str(self.user)
2016-07-02 13:58:50 +00:00
class Article(models.Model):
name = models.CharField(max_length=255)
prix = models.DecimalField(max_digits=5, decimal_places=2)
cotisation = models.BooleanField()
duration = models.IntegerField(help_text="Durée exprimée en mois entiers", blank=True, null=True)
2016-07-02 13:58:50 +00:00
def __str__(self):
return self.name
class Banque(models.Model):
name = models.CharField(max_length=255)
def __str__(self):
return self.name
class Paiement(models.Model):
moyen = models.CharField(max_length=255)
def __str__(self):
return self.moyen
class Cotisation(models.Model):
2016-07-04 01:21:25 +00:00
facture = models.OneToOneField('Facture', on_delete=models.PROTECT)
date_start = models.DateTimeField()
date_end = models.DateTimeField()
def __str__(self):
return str(self.facture)