Fix/Correction affectation departement
Some checks failed
Organisation/sirh/pipeline/head There was a failure building this commit
Some checks failed
Organisation/sirh/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
from datetime import datetime
|
||||
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
@@ -33,9 +31,11 @@ class DomaineDeRecherche(models.Model):
|
||||
|
||||
DOMAINE_RECHERCHE = (
|
||||
('sciences_sociales', 'Sciences sociales'),
|
||||
('naturelles', 'Naturelles'),
|
||||
('humaines', 'Humaines'),
|
||||
('veterinaires', 'Vétérinaires')
|
||||
('epidemiologie', 'Epidémiologie'),
|
||||
('sciences_biomedicales', 'Sciences biomédicales'),
|
||||
('service_pedagogique', 'Service Pédagogique'),
|
||||
('recherche_clinique', 'Recherche clinique')
|
||||
)
|
||||
|
||||
nom = models.CharField(
|
||||
@@ -54,13 +54,6 @@ class DomaineDeRecherche(models.Model):
|
||||
|
||||
class Projet(models.Model):
|
||||
"""Modèle représentant un projet de recherche avec ses caractéristiques et son bailleur associé."""
|
||||
TYPE_PROJET = (
|
||||
('laboratoire', 'Laboratoire'),
|
||||
('épidémiologie', 'Épidémiologie'),
|
||||
('sciences sociales', 'Sciences sociales'),
|
||||
('cliniques', 'Cliniques'),
|
||||
('autre', 'Autre'),
|
||||
)
|
||||
|
||||
id_projet = models.CharField(
|
||||
max_length=100,
|
||||
@@ -86,12 +79,6 @@ class Projet(models.Model):
|
||||
description = models.TextField(
|
||||
verbose_name="Description"
|
||||
)
|
||||
type_projet = models.CharField(
|
||||
max_length=100,
|
||||
choices=TYPE_PROJET,
|
||||
default='épidémiologie',
|
||||
verbose_name="Type de projet"
|
||||
)
|
||||
domaine_recherche = models.ManyToManyField(DomaineDeRecherche)
|
||||
budget=models.DecimalField(
|
||||
max_digits=12,
|
||||
@@ -114,13 +101,13 @@ class Projet(models.Model):
|
||||
|
||||
@property
|
||||
def statut(self):
|
||||
if self.date_fin < datetime.date.today():
|
||||
if self.date_fin < timezone.now().date():
|
||||
return "Terminé"
|
||||
return "En cours"
|
||||
|
||||
@property
|
||||
def avancement(self):
|
||||
aujourd_hui = datetime.date.today()
|
||||
aujourd_hui = timezone.now().date()
|
||||
if (self.date_debut and self.date_fin) and (self.date_debut < self.date_fin):
|
||||
duree_projet = (self.date_fin - self.date_debut).days
|
||||
temps_ecoule = (aujourd_hui - self.date_debut).days
|
||||
@@ -309,4 +296,4 @@ class LivrablesLivres(models.Model):
|
||||
null = True
|
||||
)
|
||||
def __str__(self):
|
||||
return self.nom
|
||||
return self.nom
|
||||
|
||||
Reference in New Issue
Block a user