diff options
5 files changed, 45 insertions, 1 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index 054c5254e..e1b49bbe3 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -247,6 +247,11 @@ class RecordFormGeneral(CustomForm, ManageOldType): widget=forms.Textarea, required=False) excavation_technic = forms.ChoiceField( label=_(u"Excavation technique"), choices=[], required=False) + surface = forms.IntegerField( + required=False, widget=widgets.AreaWidget, + label=_(u"Total surface (m2)"), + validators=[validators.MinValueValidator(0), + validators.MaxValueValidator(999999999)]) length = forms.FloatField(label=_(u"Length (m)"), required=False) width = forms.FloatField(label=_(u"Width (m)"), required=False) thickness = forms.FloatField(label=_(u"Thickness (m)"), required=False) diff --git a/archaeological_context_records/migrations/0107_auto_20201201_1336.py b/archaeological_context_records/migrations/0107_auto_20201201_1336.py new file mode 100644 index 000000000..bee8d07b5 --- /dev/null +++ b/archaeological_context_records/migrations/0107_auto_20201201_1336.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.27 on 2020-12-01 13:36 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_context_records', '0106_views_related_cr'), + ] + + operations = [ + migrations.AddField( + model_name='contextrecord', + name='surface', + field=models.IntegerField(blank=True, null=True, verbose_name='Surface (m2)'), + ), + migrations.AddField( + model_name='historicalcontextrecord', + name='surface', + field=models.IntegerField(blank=True, null=True, verbose_name='Surface (m2)'), + ), + ] diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 8a1011084..715e6286c 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -559,6 +559,7 @@ class ContextRecord(BulkUpdatedItem, DocumentItem, BaseHistorizedItem, depth = models.FloatField(_("Depth (m)"), blank=True, null=True) depth_of_appearance = models.FloatField( _("Depth of appearance (m)"), blank=True, null=True) + surface = models.IntegerField(_("Surface (m2)"), blank=True, null=True) location = models.TextField( _("Location"), blank=True, null=True, help_text=_("A short description of the location of the context " @@ -647,6 +648,11 @@ class ContextRecord(BulkUpdatedItem, DocumentItem, BaseHistorizedItem, def __str__(self): return self.short_label or "" + @property + def surface_ha(self): + if self.surface: + return self.surface / 10000.0 + def public_representation(self): dct = super(ContextRecord, self).public_representation() dct.update({ diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index e15a07f70..bcfb8db97 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -130,6 +130,14 @@ {% field_flex_full "Comment on datings" item.datings_comment "<pre>" "</pre>" has_image %} {% field_flex_full "Description" item.description "<pre>" "</pre>" has_image %} {% field_flex_full "Comment" item.comment "<pre>" "</pre>" has_image %} + {% if item.surface %} + <dl class="col-12 col-md-6 col-lg-3 flex-wrap"> + <dt>{%trans "Surface"%}</dt> + <dd> + {{ item.surface }} m<sup>2</sup> ({{ item.surface_ha }} ha) + </dd> + </dl> + {% endif %} {% field_flex "Length (m)" item.length '' '' has_image %} {% field_flex "Width (m)" item.width '' '' has_image %} {% field_flex "Diameter (m)" item.diameter '' '' has_image %} diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 8613822e1..c4eef1fc2 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -829,7 +829,7 @@ class OperationFormGeneral(CustomForm, ManageOldType): validators=[valid_id(Person)], required=False) surface = forms.IntegerField( required=False, widget=widgets.AreaWidget, - label=_(u"Total surface (m2)"), + label=_("Total surface (m2)"), validators=[validators.MinValueValidator(0), validators.MaxValueValidator(999999999)]) start_date = DateField(label=_(u"Start date"), required=False) |