32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
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,
|
|
}
|