File size: 3,489 Bytes
113d0af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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)