summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-09-09 22:36:23 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2015-09-09 22:36:23 +0200
commit60e6cdb0fe82d3ddad78f3488b8de46744a41e94 (patch)
tree47dd66ff1e6bd95e1e799b6823d9e40e0a5e0438 /archaeological_finds
parentda926e6708b89dcaee865632784781c54ace833b (diff)
downloadIshtar-60e6cdb0fe82d3ddad78f3488b8de46744a41e94.tar.bz2
Ishtar-60e6cdb0fe82d3ddad78f3488b8de46744a41e94.zip
Archaeological finds: update sheet and search
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/forms.py3
-rw-r--r--archaeological_finds/models.py5
-rw-r--r--archaeological_finds/templates/ishtar/sheet_find.html51
3 files changed, 34 insertions, 25 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index 82c32b2dc..ae91b8383 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -126,6 +126,7 @@ class FindSelect(TableSelect):
dating__period = forms.ChoiceField(label=_(u"Period"), choices=[])
# TODO search by warehouse
material_type = forms.ChoiceField(label=_(u"Material type"), choices=[])
+ object_types = forms.ChoiceField(label=_(u"Object type"), choices=[])
conservatory_state = forms.ChoiceField(label=_(u"Conservatory state"),
choices=[])
base_finds__find__description = forms.CharField(label=_(u"Description"))
@@ -144,6 +145,8 @@ class FindSelect(TableSelect):
models.ConservatoryState.get_types()
self.fields['conservatory_state'].help_text = \
models.ConservatoryState.get_help()
+ self.fields['object_types'].choices = \
+ models.ObjectType.get_types()
class FindFormSelection(forms.Form):
diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py
index 947cd9067..ce56fac27 100644
--- a/archaeological_finds/models.py
+++ b/archaeological_finds/models.py
@@ -76,7 +76,7 @@ class ObjectType(GeneralType):
verbose_name_plural = _(u"Object types")
ordering = ('parent__label', 'label',)
- def __unicode__(self):
+ def full_label(self):
lbls = [self.label]
item = self
while item.parent:
@@ -84,6 +84,9 @@ class ObjectType(GeneralType):
lbls.append(item.label)
return u" > ".join(reversed(lbls))
+ def __unicode__(self):
+ return self.label
+
class BaseFind(BaseHistorizedItem, OwnPerms):
label = models.CharField(_(u"ID"), max_length=60)
diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html
index c5bd637a5..3047b7e87 100644
--- a/archaeological_finds/templates/ishtar/sheet_find.html
+++ b/archaeological_finds/templates/ishtar/sheet_find.html
@@ -1,5 +1,5 @@
{% extends "ishtar/sheet.html" %}
-{% load i18n %}
+{% load i18n window_field %}
{% block head_sheet %}
{{block.super}}
@@ -28,29 +28,32 @@
<a href='{{item.image.url}}' rel="prettyPhoto" title="{{item.label}}"><img src='{{item.thumbnail.url}}'/></a>
{% endif%}
-{% if item.label %}<p><label>{%trans "Name"%}{% trans ":"%}</label>
-<span class='value'>{{item.label}}</span></p>{% endif %}
-{% if item.description %}<p><label>{%trans "Description"%}{% trans ":"%}</label>
-<span class='value'>{{item.description}}</span></p>{% endif%}
-<p><label>{%trans "Created by:"%}</label> <span class='value'>{{ item.history_creator.ishtaruser.full_label }}</span></p>
-<p><label>{%trans "Material type"%}{% trans ":"%}</label>
-<span class='value'>{{item.material_type}}</span></p>
-{% if item.dating %}<p><label>{%trans "Dating"%}{% trans ":"%}</label>
-<span class='value'>{{item.dating}}</span></p>{% endif %}
-{% if item.volume %}<p><label>{%trans "Volume (l)"%}{% trans ":"%}</label>
-<span class='value'>{{item.volume}}</span></p>{% endif%}
-{% if item.weight %}<p><label>{%trans "Weight"%}{% trans ":"%}</label>
-<span class='value'>{{item.weight}} {% if item.weight_unit %}{{item.weight_unit}}{% else %}g{% endif %}</span></p>{% endif%}
-{% if item.find_number %}<p><label>{%trans "Find number"%}{% trans ":"%}</label>
-<span class='value'>{{item.find_number}}</span></p>{% endif%}
-
-{% if item.conservatory_state %}
-<p><label>{%trans "Conservatory state"%}{% trans ":"%}</label>
-<span class='value'>{{item.conservatory_state}}</span></p>
-{% endif %}
-{% if item.preservation_to_consider %}
-<p><label>{%trans "Type of preservation to consider"%}{% trans ":"%}</label>
-<span class='value'>{{item.preservation_to_consider}}</span></p>
+{% field "Name" item.label %}
+{% field "Description" item.description %}
+{% field "Created by" item.history_creator.ishtaruser.full_label %}
+{% field "Material type" item.material_type %}
+{% field "Dating" item.dating %}
+{% field "Length (cm)" item.length %}
+{% field "Width (cm)" item.width %}
+{% field "Height (cm)" item.height %}
+{% field "Diameter (cm)" item.diameter %}
+{% field "Volume (l)" item.volume %}
+
+{% if item.weight %}{% with item.weight|add:' '|add:item.weight_unit as weight %}
+{% field "Weight" weight %}
+{% endwith %}{% endif %}
+
+{% field "Find number" item.find_number %}
+{% field "Conservatory state" item.conservatory_state %}
+{% field "Type of preservation to consider" item.preservation_to_consider %}
+
+{% if item.object_types.count %}
+<p>
+ <label>{% trans "Object types" %}</label>
+ <span class='value'>{% for object_type in item.object_types.all %}
+ {% if forloop.counter0 %}, {% endif %}{{ object_type }}
+ {% endfor %}</span>
+</p>
{% endif %}
{% if item.upstream_treatment %}<p><label>{%trans "Upstream treatment"%}{% trans ":"%}</label>