summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-04-13 13:23:35 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-04-13 13:23:35 +0200
commitae9366fc3f24d869fa9cce7c0077d06e6db95571 (patch)
tree71d968e3d0b0571b4c1d1bef036774f30e98dbcf /archaeological_finds
parentb790e4875b47e2951a65eedd36dc661079667541 (diff)
downloadIshtar-ae9366fc3f24d869fa9cce7c0077d06e6db95571.tar.bz2
Ishtar-ae9366fc3f24d869fa9cce7c0077d06e6db95571.zip
New type of operation: court-ordered seizure with associated fields (refs #4048)
* models * migrations * wizard panel * forms * sheet
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/forms.py30
-rw-r--r--archaeological_finds/migrations/0022_auto_20180413_1147.py25
-rw-r--r--archaeological_finds/models_finds.py7
-rw-r--r--archaeological_finds/templates/ishtar/sheet_find.html1
-rw-r--r--archaeological_finds/wizards.py7
5 files changed, 54 insertions, 16 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index 6811f7773..15d86f91f 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -152,6 +152,7 @@ class FindForm(CustomForm, ManageOldType):
get_first_base_find__excavation_id = forms.CharField(
label=_(u"Excavation ID"), required=False)
museum_id = forms.CharField(label=_(u"Museum ID"), required=False)
+ seal_number = forms.CharField(label=_(u"Seal number"), required=False)
mark = forms.CharField(label=_(u"Mark"), required=False)
HEADERS['description'] = FormHeader(_(u"Description"))
@@ -235,25 +236,24 @@ class FindForm(CustomForm, ManageOldType):
FieldType('communicabilitie', models.CommunicabilityType,
is_multiple=True),
FieldType('get_first_base_find__batch', models.BatchType),
+ FieldType('get_first_base_find__spatial_reference_system',
+ SpatialReferenceSystem),
]
+ PROFILE_FILTER = {
+ 'mapping': [
+ 'get_first_base_find__x', 'get_first_base_find__y',
+ 'get_first_base_find__z', 'get_first_base_find__estimated_error_x',
+ 'get_first_base_find__estimated_error_y',
+ 'get_first_base_find__estimated_error_z',
+ 'get_first_base_find__spatial_reference_system'
+ ],
+ }
def __init__(self, *args, **kwargs):
+ context_record = kwargs.pop('context_record')
super(FindForm, self).__init__(*args, **kwargs)
- if not get_current_profile().mapping:
- for k in ['get_first_base_find__x', 'get_first_base_find__y',
- 'get_first_base_find__z',
- 'get_first_base_find__estimated_error_x',
- 'get_first_base_find__estimated_error_y',
- 'get_first_base_find__estimated_error_z',
- 'get_first_base_find__spatial_reference_system',]:
- self.fields.pop(k)
- else:
- srs = 'get_first_base_find__spatial_reference_system'
- self.fields[srs].choices = \
- SpatialReferenceSystem.get_types(
- initial=self.init_data.get(srs))
- self.fields[srs].help_text = \
- SpatialReferenceSystem.get_help()
+ if not context_record.operation.operation_type.judiciary:
+ self.fields.pop('seal_number')
self.fields['checked'].choices = models.CHECK_CHOICES
def clean(self):
diff --git a/archaeological_finds/migrations/0022_auto_20180413_1147.py b/archaeological_finds/migrations/0022_auto_20180413_1147.py
new file mode 100644
index 000000000..4b46d4da6
--- /dev/null
+++ b/archaeological_finds/migrations/0022_auto_20180413_1147.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.10 on 2018-04-13 11:47
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_finds', '0021_auto_20180403_1120'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='find',
+ name='seal_number',
+ field=models.TextField(blank=True, null=True, verbose_name='Seal number'),
+ ),
+ migrations.AddField(
+ model_name='historicalfind',
+ name='seal_number',
+ field=models.TextField(blank=True, null=True, verbose_name='Seal number'),
+ ),
+ ]
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index ae3c45579..ecb4d049b 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -559,7 +559,8 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, ImageModel,
CHECK_DICT = dict(CHECK_CHOICES)
SHOW_URL = 'show-find'
SLUG = 'find'
- TABLE_COLS = ['external_id', 'label', 'base_finds__context_record__parcel__town__name',
+ TABLE_COLS = ['external_id', 'label',
+ 'base_finds__context_record__parcel__town__name',
'base_finds__context_record__operation__common_name',
'base_finds__context_record__label',
'material_types__label', 'object_types__label',
@@ -683,6 +684,10 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, ImageModel,
external_id = models.TextField(_(u"External ID"), blank=True, null=True)
auto_external_id = models.BooleanField(
_(u"External ID is set automatically"), default=False)
+ # judiciary operation
+ seal_number = models.TextField(
+ _(u"Seal number"), blank=True, null=True
+ )
order = models.IntegerField(_(u"Order"), default=1)
label = models.TextField(_(u"Free ID"))
denomination = models.TextField(_(u"Denomination"), blank=True, null=True)
diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html
index de1993634..5062963ba 100644
--- a/archaeological_finds/templates/ishtar/sheet_find.html
+++ b/archaeological_finds/templates/ishtar/sheet_find.html
@@ -41,6 +41,7 @@
{% field_flex "Previous ID" item.previous_id %}
{% field_flex "Excavation ID" item.excavation_ids %}
{% field_flex "Museum ID" item.museum_id %}
+ {% field_flex "Seal number" item.seal_number %}
{% trans "Administrative index" as admin_index_label %}
{% field_flex admin_index_label item.administrative_index %}
{% include "ishtar/blocks/sheet_creation_section.html" %}
diff --git a/archaeological_finds/wizards.py b/archaeological_finds/wizards.py
index b4471a80b..b244118cd 100644
--- a/archaeological_finds/wizards.py
+++ b/archaeological_finds/wizards.py
@@ -51,6 +51,13 @@ class FindWizard(Wizard):
if base_finds:
return base_finds[0].context_record
+ def get_form_kwargs(self, step=None):
+ kwargs = super(FindWizard, self).get_form_kwargs(step)
+ if step not in ('find-find_creation', 'find-find_modification'):
+ return kwargs
+ kwargs['context_record'] = self.get_current_contextrecord()
+ return kwargs
+
def get_context_data(self, form, **kwargs):
"""
Get the operation and context record "reminder" on top of wizard forms