diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-01-12 17:03:24 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-01-12 17:05:56 +0100 |
commit | a284cfd414663d878a01ab7cbcb1c25d3a45fcfe (patch) | |
tree | b92b5ef5c085e03669a9227fe2512ed7e9d459ed /archaeological_finds/models_finds.py | |
parent | ebce71ee6d96820ebebccc912d4636d04278fed3 (diff) | |
download | Ishtar-a284cfd414663d878a01ab7cbcb1c25d3a45fcfe.tar.bz2 Ishtar-a284cfd414663d878a01ab7cbcb1c25d3a45fcfe.zip |
Add a mapping module - Finds: add explicit x, y, z - automatically update point and point_2d
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r-- | archaeological_finds/models_finds.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index e29669773..93bed4ab3 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -26,7 +26,7 @@ from django.db.models import Max, Q from django.db.models.signals import m2m_changed, post_save, post_delete from django.utils.translation import ugettext_lazy as _, ugettext -from ishtar_common.utils import cached_label_changed +from ishtar_common.utils import cached_label_changed, post_save_point from ishtar_common.models import GeneralType, ImageModel, BaseHistorizedItem, \ ShortMenuItem, LightHistorizedItem, HistoricalRecords, OwnPerms, Source, \ @@ -35,7 +35,7 @@ from ishtar_common.models import GeneralType, ImageModel, BaseHistorizedItem, \ from archaeological_operations.models import AdministrativeAct from archaeological_context_records.models import ContextRecord, Dating -from ishtar_common.models import PRIVATE_FIELDS +from ishtar_common.models import PRIVATE_FIELDS, SpatialReferenceSystem from archaeological_warehouse.models import Container, Collection @@ -130,8 +130,6 @@ class BaseFind(BaseHistorizedItem, OwnPerms): _(u"External ID is set automatically"), default=False) description = models.TextField(_(u"Description"), blank=True, null=True) comment = models.TextField(_(u"Comment"), blank=True, null=True) - topographic_localisation = models.CharField( - _(u"Topographic localisation"), blank=True, null=True, max_length=120) special_interest = models.CharField(_(u"Special interest"), blank=True, null=True, max_length=120) context_record = models.ForeignKey( @@ -143,6 +141,22 @@ class BaseFind(BaseHistorizedItem, OwnPerms): choices=IS_ISOLATED_CHOICES) index = models.IntegerField(u"Index", default=0) material_index = models.IntegerField(_(u"Material index"), default=0) + topographic_localisation = models.CharField( + _(u"Point of topographic reference"), blank=True, null=True, + max_length=120) + x = models.FloatField(_(u'X'), blank=True, null=True) + y = models.FloatField(_(u'Y'), blank=True, null=True) + z = models.FloatField(_(u'Z'), blank=True, null=True) + estimated_error_x = models.FloatField(_(u'Estimated error for X'), + blank=True, null=True) + estimated_error_y = models.FloatField(_(u'Estimated error for Y'), + blank=True, null=True) + estimated_error_z = models.FloatField(_(u'Estimated error for Z'), + blank=True, null=True) + spatial_reference_system = models.ForeignKey( + SpatialReferenceSystem, verbose_name=_(u"Spatial Reference System"), + blank=True, null=True) + point_2d = models.PointField(_(u"Point (2D)"), blank=True, null=True) point = models.PointField(_(u"Point"), blank=True, null=True, dim=3) line = models.LineStringField(_(u"Line"), blank=True, null=True) polygon = models.PolygonField(_(u"Polygon"), blank=True, null=True) @@ -273,6 +287,9 @@ class BaseFind(BaseHistorizedItem, OwnPerms): self.save() return returned +post_save.connect(post_save_point, sender=BaseFind) + + WEIGHT_UNIT = (('g', _(u"g")), ('kg', _(u"kg")),) @@ -437,9 +454,6 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): height = models.FloatField(_(u"Height (cm)"), blank=True, null=True) diameter = models.FloatField(_(u"Diameter (cm)"), blank=True, null=True) thickness = models.FloatField(_(u"Thickness (cm)"), blank=True, null=True) - topographic_reference_point = models.CharField( - _(u"Point of topographic reference"), max_length=20, - blank=True, null=True) dimensions_comment = models.TextField(_(u"Dimensions comment"), blank=True, null=True) mark = models.TextField(_(u"Mark"), blank=True, null=True) |