summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-02-09 12:03:49 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-02-09 12:03:49 +0100
commitf0530e93692a90d05a9745e5db92518d10b1e267 (patch)
tree469c8099b61a234f1a64ac57253cf22833a6e14b
parent8c4f1318e070eae0dafc35db03b0de7571063c24 (diff)
downloadIshtar-f0530e93692a90d05a9745e5db92518d10b1e267.tar.bz2
Ishtar-f0530e93692a90d05a9745e5db92518d10b1e267.zip
Document duplicate: add reference field
-rw-r--r--ishtar_common/forms_common.py5
-rw-r--r--ishtar_common/templates/ishtar/forms/qa_document_duplicate.html5
2 files changed, 9 insertions, 1 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index dfd364764..b28e40a5c 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -2069,6 +2069,7 @@ class QADocumentFormMulti(QAForm):
class QADocumentDuplicateForm(IshtarForm):
qa_title = forms.CharField(label=_("Title"), max_length=500, required=False)
+ qa_reference = forms.CharField(label=_("Reference"), max_length=500, required=False)
qa_source_type = forms.ChoiceField(label=_("Type"), choices=[], required=False)
open_edit = forms.BooleanField(label=_("Edit duplicated item"), required=False)
open_edit.widget.NO_FORM_CONTROL = True
@@ -2086,6 +2087,8 @@ class QADocumentDuplicateForm(IshtarForm):
self.document = kwargs.pop("items")[0]
super(QADocumentDuplicateForm, self).__init__(*args, **kwargs)
self.fields["qa_title"].initial = self.document.title + str(_(" - duplicate"))
+ if self.document.reference:
+ self.fields["qa_reference"].initial = self.document.reference
if self.document.source_type:
self.fields["qa_source_type"].initial = self.document.source_type.pk
@@ -2106,7 +2109,7 @@ class QADocumentDuplicateForm(IshtarForm):
def save(self):
data = {"index": None}
- for k in ["title"]:
+ for k in ["title", "reference"]:
data[k] = self.cleaned_data.get("qa_" + k, None)
if self.cleaned_data.get("qa_source_type", None):
try:
diff --git a/ishtar_common/templates/ishtar/forms/qa_document_duplicate.html b/ishtar_common/templates/ishtar/forms/qa_document_duplicate.html
index f299f3c24..e1073bf83 100644
--- a/ishtar_common/templates/ishtar/forms/qa_document_duplicate.html
+++ b/ishtar_common/templates/ishtar/forms/qa_document_duplicate.html
@@ -14,6 +14,11 @@
{% endwith %}
</div>
<div class="form-row">
+ {% with form.qa_reference as field %}
+ {% include "blocks/bs_field_snippet.html" %}
+ {% endwith %}
+</div>
+<div class="form-row">
{% with form.qa_source_type as field %}
{% include "blocks/bs_field_snippet.html" %}
{% endwith %}