diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-01-31 15:54:44 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-01-31 15:54:44 +0100 |
commit | 5a23971fc3425e5c3986bfc7fb4b57c9f7bb96e0 (patch) | |
tree | de217d6e01832fed06cbbb52d374b2d238b68d74 | |
parent | 4204cc1b835cfd5bcfe3a0850372d301cc019de1 (diff) | |
download | Ishtar-5a23971fc3425e5c3986bfc7fb4b57c9f7bb96e0.tar.bz2 Ishtar-5a23971fc3425e5c3986bfc7fb4b57c9f7bb96e0.zip |
Container: add old reference (refs #3869)
-rw-r--r-- | archaeological_warehouse/forms.py | 4 | ||||
-rw-r--r-- | archaeological_warehouse/migrations/0013_auto_20180131_1551.py | 25 | ||||
-rw-r--r-- | archaeological_warehouse/models.py | 7 | ||||
-rw-r--r-- | archaeological_warehouse/templates/ishtar/sheet_container.html | 1 |
4 files changed, 34 insertions, 3 deletions
diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index f020864ff..dcd16963e 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -162,7 +162,9 @@ class ContainerForm(ManageOldType, forms.Form): associated_models = {'container_type': models.ContainerType, 'location': models.Warehouse, 'responsible': models.Warehouse} - reference = forms.CharField(label=_(u"Ref.")) + reference = forms.CharField(label=_(u"Ref."), max_length=200) + old_reference = forms.CharField(label=_(u"Old reference"), required=False, + max_length=200) container_type = forms.ChoiceField(label=_(u"Container type"), choices=[]) location = forms.IntegerField( label=_(u"Current location (warehouse)"), diff --git a/archaeological_warehouse/migrations/0013_auto_20180131_1551.py b/archaeological_warehouse/migrations/0013_auto_20180131_1551.py new file mode 100644 index 000000000..327b5adc4 --- /dev/null +++ b/archaeological_warehouse/migrations/0013_auto_20180131_1551.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2018-01-31 15:51 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_warehouse', '0012_auto_20180109_1057'), + ] + + operations = [ + migrations.AddField( + model_name='container', + name='old_reference', + field=models.CharField(blank=True, max_length=200, null=True, verbose_name='Old reference'), + ), + migrations.AlterField( + model_name='container', + name='reference', + field=models.CharField(max_length=200, verbose_name='Container ref.'), + ), + ] diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index d6c33583f..6ea5a7d10 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -259,7 +259,7 @@ post_delete.connect(post_save_cache, sender=ContainerType) class Container(LightHistorizedItem, ImageModel): TABLE_COLS = ['reference', 'container_type__label', 'cached_location', - 'divisions_lbl'] + 'divisions_lbl', 'old_reference'] IMAGE_PREFIX = 'containers/' # search parameters @@ -267,6 +267,7 @@ class Container(LightHistorizedItem, ImageModel): 'location': 'location__pk', 'container_type': 'container_type__pk', 'reference': 'reference__icontains', + 'old_reference': 'old_reference__icontains', 'finds__base_finds__context_record__operation': 'finds__base_finds__context_record__operation', 'finds__base_finds__context_record': @@ -290,13 +291,15 @@ class Container(LightHistorizedItem, ImageModel): related_name='owned_containers') container_type = models.ForeignKey(ContainerType, verbose_name=_("Container type")) - reference = models.CharField(_(u"Container ref."), max_length=40) + reference = models.CharField(_(u"Container ref."), max_length=200) comment = models.TextField(_(u"Comment"), null=True, blank=True) cached_label = models.CharField(_(u"Localisation"), max_length=500, null=True, blank=True, db_index=True) cached_location = models.CharField(_(u"Cached location"), max_length=500, null=True, blank=True, db_index=True) index = models.IntegerField(u"Container ID", default=0) + old_reference = models.CharField(_(u"Old reference"), max_length=200, + blank=True, null=True) external_id = models.TextField(_(u"External ID"), blank=True, null=True) auto_external_id = models.BooleanField( _(u"External ID is set automatically"), default=False) diff --git a/archaeological_warehouse/templates/ishtar/sheet_container.html b/archaeological_warehouse/templates/ishtar/sheet_container.html index 7c9f84a32..706e9e176 100644 --- a/archaeological_warehouse/templates/ishtar/sheet_container.html +++ b/archaeological_warehouse/templates/ishtar/sheet_container.html @@ -11,6 +11,7 @@ {% endif%} <p class="window-refs">{{ item.reference|default:"" }}</p> +<p class="window-refs">{{ item.old_reference|default:"" }}</p> <p class="window-refs">{{ item.container_type|default:"" }}</p> <p class="window-refs">{{ item.responsible.name }} - {{ item.index }}</p> {% include "ishtar/blocks/sheet_external_id.html" %} |