diff options
Diffstat (limited to 'archaeological_finds/models.py')
| -rw-r--r-- | archaeological_finds/models.py | 26 | 
1 files changed, 21 insertions, 5 deletions
| diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index 0006c29a7..3e623e5ac 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -69,6 +69,13 @@ class PreservationType(GeneralType):          ordering = ('label',) +class IntegrityType(GeneralType): +    class Meta: +        verbose_name = _(u"Integrity type") +        verbose_name_plural = _(u"Integrity type") +        ordering = ('label',) + +  class ObjectType(GeneralType):      parent = models.ForeignKey("ObjectType", blank=True, null=True,                                 verbose_name=_(u"Parent")) @@ -89,8 +96,15 @@ class ObjectType(GeneralType):      def __unicode__(self):          return self.label +IS_ISOLATED_CHOICES = ( +    ('U', _(u"Unknow")), +    ('O', _(u"Object")), +    ('B', _(u"Batch")) +) +  class BaseFind(BaseHistorizedItem, OwnPerms): +    IS_ISOLATED_DICT = dict(IS_ISOLATED_CHOICES)      label = models.CharField(_(u"Free-ID"), max_length=60)      external_id = models.CharField(_(u"External ID"), blank=True, null=True,                                     max_length=120) @@ -105,8 +119,8 @@ class BaseFind(BaseHistorizedItem, OwnPerms):          verbose_name=_(u"Context Record"))      discovery_date = models.DateField(_(u"Discovery date"),                                        blank=True, null=True) -    is_isolated = models.NullBooleanField(_(u"Is isolated?"), blank=True, -                                          null=True) +    batch = models.CharField(_(u"Batch/object"), max_length=1, default="U", +                             choices=IS_ISOLATED_CHOICES)      index = models.IntegerField(u"Index", default=0)      material_index = models.IntegerField(u"Material index", default=0)      cache_short_id = models.TextField( @@ -237,7 +251,7 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):                    'base_finds.context_record.operation.year',                    'base_finds.context_record.operation.operation_code',                    'container.reference', 'container.location', -                  'base_finds.is_isolated'] +                  'base_finds.batch']      if settings.COUNTRY == 'fr':          TABLE_COLS.insert(              6, 'base_finds.context_record.operation.code_patriarche') @@ -276,9 +290,9 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):      conservatory_state = models.ForeignKey(          ConservatoryState, verbose_name=_(u"Conservatory state"), blank=True,          null=True) -    preservation_to_consider = models.ForeignKey( +    preservation_to_considers = models.ManyToManyField(          PreservationType, verbose_name=_(u"Type of preservation to consider"), -        blank=True, null=True) +        related_name='finds')      volume = models.FloatField(_(u"Volume (l)"), blank=True, null=True)      weight = models.FloatField(_(u"Weight (g)"), blank=True, null=True)      weight_unit = models.CharField(_(u"Weight unit"), max_length=4, @@ -301,6 +315,8 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):                                            null=True)      object_types = models.ManyToManyField(          ObjectType, verbose_name=_(u"Object types"), related_name='find') +    integrities = models.ManyToManyField( +        IntegrityType, verbose_name=_(u"Integrity"), related_name='find')      length = models.FloatField(_(u"Length (cm)"), blank=True, null=True)      width = models.FloatField(_(u"Width (cm)"), blank=True, null=True)      height = models.FloatField(_(u"Height (cm)"), blank=True, null=True) | 
