diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2010-12-23 19:02:59 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2010-12-24 17:39:03 +0100 |
commit | d1c73804b993347ffccde530129cd23116776930 (patch) | |
tree | 6210a60d828bb1e476ad688493a33d4fbc88ec43 | |
parent | 8b6c3f0030da1f0523f6b620c3ea5b48c9be06cf (diff) | |
download | Ishtar-d1c73804b993347ffccde530129cd23116776930.tar.bz2 Ishtar-d1c73804b993347ffccde530129cd23116776930.zip |
Correct the historization (refs #25)
-rw-r--r-- | ishtar/furnitures/models.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ishtar/furnitures/models.py b/ishtar/furnitures/models.py index 87b976f1c..597e16583 100644 --- a/ishtar/furnitures/models.py +++ b/ishtar/furnitures/models.py @@ -49,13 +49,18 @@ class GeneralType(models.Model): class HistorizedItem(models.Model): history_modifier = models.ForeignKey("IshtarUser", related_name='+', verbose_name=_(u"Last modifier")) - history = HistoricalRecords() + + class Meta: + abstract = True class LightHistorizedItem(models.Model): history_modifier = models.ForeignKey("IshtarUser", related_name='+', verbose_name=_(u"Last modifier")) history_date = models.DateTimeField(default=datetime.datetime.now) + class Meta: + abstract = True + class Departement(models.Model): label = models.CharField(_(u"Label"), max_length=30) number = models.IntegerField(_(u"Number")) @@ -75,6 +80,7 @@ class Address(HistorizedItem): country = models.CharField(_(u"Country"), max_length=30) phone = models.CharField(_(u"Phone"), max_length=18) mobile_phone = models.CharField(_(u"Mobile phone"), max_length=18) + history = HistoricalRecords() class Meta: abstract = True @@ -84,10 +90,11 @@ class OrganizationType(GeneralType): verbose_name = _(u"Organization type") verbose_name_plural = _(u"Organization types") -class Organization(HistorizedItem): +class Organization(Address): name = models.CharField(_(u"Name"), max_length=100) organization_type = models.ForeignKey(OrganizationType, verbose_name=_(u"Type")) + history = HistoricalRecords() class Meta: verbose_name = _(u"Organization") verbose_name_plural = _(u"Organizations") @@ -158,6 +165,7 @@ class File(HistorizedItem): avec accusé réception") ar_signed_by = models.ForeignKey(Person, related_name='+', verbose_name=u"Signature de l'accusé de réception par") + history = HistoricalRecords() class Meta: verbose_name = _(u"Archaeological file") @@ -194,6 +202,7 @@ class Operation(HistorizedItem): code_patriarche = models.IntegerField(u"Code PATRIARCHE") code_pat = models.CharField(u"Code PAT", max_length=10) code_dracar = models.CharField(u"Code DRACAR", max_length=10) + history = HistoricalRecords() class Meta: verbose_name = _(u"Operation") @@ -263,6 +272,7 @@ class RegistrationUnit(HistorizedItem): interpretation = models.TextField(_(u"Interpretation")) filling = models.TextField(_(u"Filling")) datings = models.ManyToManyField(Dating) + history = HistoricalRecords() class Meta: verbose_name = _(u"Registration Unit") @@ -301,6 +311,7 @@ class BaseItem(HistorizedItem): verbose_name=_(u"Registration Unit")) is_isolated = models.BooleanField(_(u"Is isolated?")) documentations = models.ManyToManyField(Source) + history = HistoricalRecords() class Meta: verbose_name = _(u"Base item") @@ -324,6 +335,7 @@ class Item(HistorizedItem): downstream_treatment = models.ForeignKey("Treatment", related_name='upstream_treatment', verbose_name=_("Downstream treatment")) dating = models.ForeignKey(Dating, verbose_name=_(u"Dating")) + history = HistoricalRecords() class Meta: verbose_name = _(u"Item") @@ -379,6 +391,7 @@ class AdministrativeAct(HistorizedItem): person = models.ForeignKey(Person, verbose_name=_(u"Person")) if settings.COUNTRY == 'fr': ref_sra = models.CharField(u"Référence SRA", max_length=15) + history = HistoricalRecords() class Meta: verbose_name = _(u"Administrative act") @@ -454,6 +467,7 @@ class Treatment(HistorizedItem): person = models.ForeignKey(Person, verbose_name=_(u'Person')) start_date = models.DateField(_(u"Start date")) end_date = models.DateField(_(u"End date")) + history = HistoricalRecords() class Meta: verbose_name = _(u"Treatment") |