from django.db import models # Create your models here. from authentication.models import User class CategorieFormation(models.Model): titre = models.CharField(max_length=255) tag = models.CharField(max_length=255) icone = models.CharField(max_length=255) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now = True) class Formation(models.Model): description = models.CharField(max_length=1024) titre = models.CharField(max_length=255) image = models.FileField(max_length=1024) prerequis = models.CharField(max_length=1024) author = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) montant = models.DecimalField(default=0, max_digits=16, decimal_places= 2) categorie = models.ForeignKey(CategorieFormation, on_delete=models.SET_NULL, null=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now = True) class UserFormation(models.Model): user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) formation = models.ForeignKey(Formation, on_delete=models.SET_NULL, null=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now = True) class Cours(models.Model): titre = models.CharField(max_length=255) duree = models.IntegerField() video = models.FileField(max_length=1024) formation = models.ForeignKey(Formation, on_delete=models.SET_NULL, null=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now = True) # -------------------- class ArchiveFormation(models.Model): user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) formation = models.ForeignKey(Formation, on_delete=models.SET_NULL, null=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now = True) class ListSouhaitFormation(models.Model): user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) formation = models.ForeignKey(Formation, on_delete=models.SET_NULL, null=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now = True) class FavorisFormation(models.Model): user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) formation = models.ForeignKey(Formation, on_delete=models.SET_NULL, null=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now = True) class PanierUser(models.Model): user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) formation = models.ForeignKey(Formation, on_delete=models.SET_NULL, null=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now = True) class AvisFormation(models.Model): user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) formation = models.ForeignKey(Formation, on_delete=models.SET_NULL, null=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now = True) class PaiementUser(models.Model): user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) formation = models.ForeignKey(Formation, on_delete=models.SET_NULL, null=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now = True)