retrait de actif
[auf_rh_dae.git] / src / auf.django.metadata / auf / django / metadata / models.py
1 # -*- encoding: utf-8 -*-
2
3 from django.db import models
4 from managers import NoDeleteManager, ActifsManager, InactifsManager
5
6
7 class AUFMetadata(models.Model):
8 """
9 Méta-données AUF.
10 supprime = niveau système
11 actif = niveau utilisateur
12 """
13 supprime = models.BooleanField(default=False)
14 date_creation = models.DateTimeField(null=True, blank=True, verbose_name=u"Date de création",)
15 user_creation = models.ForeignKey('auth.User', verbose_name=u"Crée par",
16 db_column='user_creation', related_name='+',
17 null=True, blank=True)
18 date_modification = models.DateTimeField(null=True, blank=True, verbose_name=u"Date de modification",)
19 user_modification = models.ForeignKey('auth.User', verbose_name=u"Modifié par",
20 db_column='user_modification', related_name='+',
21 null=True, blank=True)
22 date_activation = models.DateTimeField(null=True, blank=True, verbose_name=u"Date d'activation",)
23 user_activation = models.ForeignKey('auth.User', verbose_name=u"Activé par",
24 db_column='user_activation', related_name='+',
25 null=True, blank=True)
26 date_desactivation = models.DateTimeField(null=True, blank=True, verbose_name=u"Date de désactivation",)
27 user_desactivation = models.ForeignKey('auth.User', verbose_name=u"Désactivé par",
28 db_column='user_desactivation', related_name='+',
29 null=True, blank=True)
30
31 objects = NoDeleteManager()
32 actifs = ActifsManager()
33 inactifs = InactifsManager()
34
35 class Meta:
36 abstract = True
37
38 def delete(self):
39 self.supprime = True
40 self.save()
41
42