File size: 4,357 Bytes
113d0af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61327a7
 
 
 
113d0af
 
9434a1a
113d0af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61327a7
113d0af
 
 
61327a7
 
 
 
 
 
 
 
 
 
 
 
 
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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)
    level = models.CharField(max_length=1024)
    langue = models.CharField(max_length=1024)
    langue_dub = models.CharField(max_length=1024)
    langue_subtitles = 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,related_name='formations')
    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)
    montant = models.DecimalField(decimal_places = 3, null = True, max_digits = 15)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now = True)

class RessourceCours(models.Model):

    RESSOURCE_CHOICES = (
        ('Dubbing', 'Dubbing'),
        ('Subtitle', 'Subtitle')
    )
    cour = models.ForeignKey(Cours, on_delete=models.SET_NULL, null=True)
    titre = models.CharField(max_length=1024)
    description = models.CharField(max_length=1024)
    type_ressource = models.CharField(max_length=1024, choices=RESSOURCE_CHOICES, default=('Dubbing', 'Dubbing'))
    updated_at = models.DateTimeField(auto_now = True)
    created_at = models.DateTimeField(auto_now_add=True)
    file_link = models.FileField(max_length=1024)