summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/forms_treatments.py18
-rw-r--r--archaeological_finds/templates/ishtar/forms/qa_find_treatment.html12
2 files changed, 21 insertions, 9 deletions
diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py
index b80b6c0fe..c62dbcc57 100644
--- a/archaeological_finds/forms_treatments.py
+++ b/archaeological_finds/forms_treatments.py
@@ -399,25 +399,29 @@ class TreatmentDeletionForm(FinalForm):
class QAFindTreatmentForm(IshtarForm):
container = forms.IntegerField(
- label=_(u"Container"),
+ label=_("Container"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-container'),
associated_model=Container, new=True),
validators=[valid_id(Container)])
container_to_change = forms.ChoiceField(
- label=_(u"Change "), required=True,
+ label=_("Change "), required=True,
choices=(
('current-and-reference', _(u"current and reference containers")),
('reference', _(u"the reference container")),
('current', _(u"the current container")),
)
)
+ collection = forms.BooleanField(
+ label=_("Associate to the collection of the container"), required=False,
+ widget=widgets.CheckboxInput
+ )
create_treatment = forms.BooleanField(
- label=_(u"Create a treatment"), required=False,
+ label=_("Create a treatment"), required=False,
widget=widgets.CheckboxInput
)
treatment_type = forms.ChoiceField(
- label=_(u"Treatment type"), choices=[], required=False
+ label=_("Treatment type"), choices=[], required=False
)
year = forms.IntegerField(
label=_("Year"), initial=lambda: datetime.datetime.now().year,
@@ -527,8 +531,14 @@ class QAFindTreatmentForm(IshtarForm):
container_attrs.append('container_ref')
if container_to_change in ('current', 'current-and-reference'):
container_attrs.append('container')
+ collection = None
+ if self.cleaned_data.get("collection"):
+ collection = container.location_id
for find in items:
changed = False
+ if collection and find.collection_id != collection:
+ find.collection_id = collection
+ changed = True
for container_attr in container_attrs:
if getattr(find, container_attr) == container:
continue
diff --git a/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html b/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html
index 38db02ff4..c7944f2a0 100644
--- a/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html
+++ b/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html
@@ -24,23 +24,25 @@
{% with form.container as field %}
{% include "blocks/bs_field_snippet.html" %}
{% endwith %}
- </div>
-
- <div class="form-row">
{% with form.container_to_change as field %}
{% include "blocks/bs_field_snippet.html" %}
{% endwith %}
</div>
+ <div class="form-row">
+ {{ form.collection }}&nbsp;<label for="{{form.collection.auto_id}}">
+ {% trans "Associate to the collection of the container" %}
+ </label>
+ </div>
<div class="form-row">
{{ form.create_treatment }}&nbsp;<label for="{{form.create_treatment.auto_id}}">
- {% trans "Associate a treatment" %}
+ {% trans "Associate a treatment" %}
</label>
</div>
<div id="new-treatment">
<div class="form-row">
{% with force_large_col=false %}{% for field in form %}
- {% if field.name != 'container_to_change' and field.name != 'container' and field.name != 'create_treatment' %}
+ {% if field.name != 'container_to_change' and field.name != 'collection' and field.name != 'container' and field.name != 'create_treatment' %}
{% include "blocks/bs_field_snippet.html" %}
{% endif %}
{% endfor %}{% endwith %}