diff options
Diffstat (limited to 'archaeological_context_records/models.py')
| -rw-r--r-- | archaeological_context_records/models.py | 58 | 
1 files changed, 41 insertions, 17 deletions
| diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 1ec32ea83..4df56c49f 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -1,6 +1,6 @@  #!/usr/bin/env python  # -*- coding: utf-8 -*- -# Copyright (C) 2012-2016 Étienne Loks  <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2012-2017 Étienne Loks  <etienne.loks_AT_peacefrogsDOTnet>  # This program is free software: you can redistribute it and/or modify  # it under the terms of the GNU Affero General Public License as @@ -120,6 +120,24 @@ post_save.connect(post_save_cache, sender=IdentificationType)  post_delete.connect(post_save_cache, sender=IdentificationType) +class ExcavationTechnicType(GeneralType): +    class Meta: +        verbose_name = _(u"Excavation technique type") +        verbose_name_plural = _(u"Excavation technique types") +        ordering = ('label',) +post_save.connect(post_save_cache, sender=ExcavationTechnicType) +post_delete.connect(post_save_cache, sender=ExcavationTechnicType) + + +class DocumentationType(GeneralType): +    class Meta: +        verbose_name = _(u"Documentation type") +        verbose_name_plural = _(u"Documentation types") +        ordering = ('label',) +post_save.connect(post_save_cache, sender=DocumentationType) +post_delete.connect(post_save_cache, sender=DocumentationType) + +  class CRBulkView(object):      CREATE_SQL = """          CREATE VIEW context_records_cached_label_bulk_update @@ -144,16 +162,24 @@ class ContextRecord(BaseHistorizedItem, ImageModel, OwnPerms,                        ValueGetter, ShortMenuItem):      SHOW_URL = 'show-contextrecord'      SLUG = 'contextrecord' -    TABLE_COLS = ['parcel__town__name', 'operation__year', -                  'operation__operation_code', -                  'label', 'unit'] +    TABLE_COLS = ['label', 'operation__common_name', 'parcel__town__name', +                  'parcel__label', 'unit']      if settings.COUNTRY == 'fr':          TABLE_COLS.insert(1, 'operation__code_patriarche')      TABLE_COLS_FOR_OPE = ['label', 'parcel', 'unit',                            'datings__period__label', 'description'] -    COL_LABELS = {'section__parcel_number': _(u"Parcel"), -                  'datings__period__label': _(u"Periods"), -                  'parcel__town__name': _(u"Town")} +    COL_LABELS = { +        'datings__period__label': _(u"Periods"), +        'datings__period': _(u"Datings (period)"), +        'detailled_related_context_records': _(u"Related context records"), +        'operation__code_patriarche': u"Operation (code patriarche)", +        'operation__common_name': u"Operation (name)", +        'parcel__external_id': _(u"Parcel (external ID)"), +        'parcel__town__name': _(u"Parcel (town)"), +        'parcel__town': _(u"Parcel (town)"), +        'parcel__year': _(u"Parcel (year)"), +        'section__parcel_number': _(u"Parcel"), +    }      CONTEXTUAL_TABLE_COLS = {          'full': {              'related_context_records': 'detailled_related_context_records' @@ -180,14 +206,6 @@ class ContextRecord(BaseHistorizedItem, ImageModel, OwnPerms,      RELATIVE_SESSION_NAMES = [          ('operation', 'operation__pk'),          ('file', 'operation__associated_file__pk')] -    EXTRA_FULL_FIELDS_LABELS = { -        'parcel__town': _(u"Parcel (town)"), -        'detailled_related_context_records': _(u"Related context records"), -        'operation__code_patriarche': u"Operation (code patriarche)", -        'parcel__external_id': _(u"Parcel (external ID)"), -        'datings__period': _(u"Datings (period)"), -        'parcel__year': _(u"Parcel (year)"), -    }      # fields      external_id = models.TextField(_(u"External ID"), blank=True, null=True) @@ -207,18 +225,21 @@ class ContextRecord(BaseHistorizedItem, ImageModel, OwnPerms,      width = models.FloatField(_(u"Width (m)"), blank=True, null=True)      thickness = models.FloatField(_(u"Thickness (m)"), blank=True,                                    null=True) +    diameter = models.FloatField(_(u"Diameter (m)"), blank=True, null=True)      depth = models.FloatField(_(u"Depth (m)"), blank=True, null=True) +    depth_of_appearance = models.FloatField( +        _(u"Depth of appearance (m)"), blank=True, null=True)      location = models.TextField(          _(u"Location"), blank=True, null=True,          help_text=_(u"A short description of the location of the context "                      u"record"))      datings = models.ManyToManyField(Dating) +    documentations = models.ManyToManyField(DocumentationType, blank=True, +                                            null=True)      datings_comment = models.TextField(_(u"Comment on datings"), blank=True,                                         null=True)      unit = models.ForeignKey(Unit, verbose_name=_(u"Context record type"),                               related_name='+', blank=True, null=True) -    has_furniture = models.NullBooleanField(_(u"Has furniture?"), blank=True, -                                            null=True)      filling = models.TextField(_(u"Filling"), blank=True, null=True)      interpretation = models.TextField(_(u"Interpretation"), blank=True,                                        null=True) @@ -241,6 +262,9 @@ class ContextRecord(BaseHistorizedItem, ImageModel, OwnPerms,          verbose_name=_(u"Identification"),)      activity = models.ForeignKey(ActivityType, blank=True, null=True,                                   verbose_name=_(u"Activity"),) +    excavation_technic = models.ForeignKey( +        ExcavationTechnicType, blank=True, null=True, +        verbose_name=_(u"Excavation technique"))      related_context_records = models.ManyToManyField(          'ContextRecord', through='RecordRelations', blank=True, null=True)      point = models.PointField(_(u"Point"), blank=True, null=True, dim=3) | 
