init
This commit is contained in:
31
backend-django/backend/models/competence.py
Normal file
31
backend-django/backend/models/competence.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from django.db import models
|
||||
|
||||
from .domaine import Domaine
|
||||
from .filiere import Filiere
|
||||
|
||||
|
||||
class Competence(models.Model):
|
||||
"""Modèle Compétences"""
|
||||
|
||||
class Cols():
|
||||
""" Constantes pour les noms de colonnes """
|
||||
|
||||
PK = 'comp_id'
|
||||
CATEGORIE = 'comp_categorie'
|
||||
LIBELLE = 'comp_libelle'
|
||||
# relations one-to-one ou many-to-one
|
||||
REL_DOMAINE = 'comp_domaine'
|
||||
REL_FILIERE = 'comp_filiere'
|
||||
|
||||
|
||||
comp_id = models.CharField('ID', primary_key=True, max_length=100)
|
||||
comp_libelle = models.CharField('libellé', null=True, blank=True, max_length=100)
|
||||
comp_domaine = models.ForeignKey(Domaine, on_delete=models.SET_NULL, null=True, blank=True, verbose_name='domaine')
|
||||
comp_filiere = models.ForeignKey(Filiere, on_delete=models.SET_NULL, null=True, blank=True, verbose_name='filière')
|
||||
comp_categorie = models.CharField('catégorie', max_length=100, null=True, blank=True)
|
||||
|
||||
def as_dict(self):
|
||||
return {
|
||||
"id": self.comp_id,
|
||||
"libelle": self.comp_libelle,
|
||||
}
|
||||
Reference in New Issue
Block a user