metadata mod in project src
[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 actif = models.BooleanField(default=True)
23 date_activation = models.DateTimeField(null=True, blank=True, verbose_name=u"Date d'activation",)
24 user_activation = models.ForeignKey('auth.User', verbose_name=u"Activé par",
25 db_column='user_activation', related_name='+',
26 null=True, blank=True)
27 date_desactivation = models.DateTimeField(null=True, blank=True, verbose_name=u"Date de désactivation",)
28 user_desactivation = models.ForeignKey('auth.User', verbose_name=u"Désactivé par",
29 db_column='user_desactivation', related_name='+',
30 null=True, blank=True)
31
32 objects = NoDeleteManager()
33 actifs = ActifsManager()
34 inactifs = InactifsManager()
35
36 class Meta:
37 abstract = True
38
39 def delete(self):
40 self.supprime = True
41 self.save()
42
43