summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-09-13 12:33:50 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-10-24 12:06:08 +0200
commit2c07eef528c7ab69385e85e6e861839e502e4646 (patch)
treefde4a330920d179f1d849a1f53eea18eff011bce
parent46fde16870a11cd68a3027dd974b4c8b36643d54 (diff)
downloadIshtar-2c07eef528c7ab69385e85e6e861839e502e4646.tar.bz2
Ishtar-2c07eef528c7ab69385e85e6e861839e502e4646.zip
QA packaging - fix date initialization
-rw-r--r--archaeological_finds/forms_treatments.py5
-rw-r--r--archaeological_finds/templates/ishtar/forms/qa_find_treatment.html10
-rw-r--r--archaeological_finds/views.py1
-rw-r--r--bootstrap_datepicker/widgets.py4
-rw-r--r--ishtar_common/models_imports.py4
-rw-r--r--ishtar_common/widgets.py4
6 files changed, 17 insertions, 11 deletions
diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py
index 364c22ed6..b09d234f0 100644
--- a/archaeological_finds/forms_treatments.py
+++ b/archaeological_finds/forms_treatments.py
@@ -288,7 +288,9 @@ class QAFindTreatmentForm(IshtarForm):
associated_model=Container, new=True),
validators=[valid_id(Container)])
create_treatment = forms.BooleanField(
- label=_(u"Create a treatment"), required=False)
+ label=_(u"Create a treatment"), required=False,
+ widget=widgets.CheckboxInput
+ )
year = forms.IntegerField(
label=_("Year"), initial=lambda: datetime.datetime.now().year,
validators=[validators.MinValueValidator(1000),
@@ -309,6 +311,7 @@ class QAFindTreatmentForm(IshtarForm):
validators=[valid_id(Organization)], required=False)
def __init__(self, *args, **kwargs):
+ self.confirm = False
self.user = None
if 'user' in kwargs:
self.user = kwargs.pop('user')
diff --git a/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html b/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html
index 07f633848..ef3906735 100644
--- a/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html
+++ b/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html
@@ -27,10 +27,8 @@
</div>
<div class="form-row">
- <input type="checkbox" name="create_treatment"
- id="create-choice">&nbsp;
- <label for="create-choice">
- {% trans "Associate a treatment to this operation" %}
+ {{ form.create_treatment }}&nbsp;<label for="{{form.create_treatment.auto_id}}">
+ {% trans "Associate a treatment" %}
</label>
</div>
<div id="new-treatment">
@@ -48,7 +46,7 @@
{% block js %}
var update_form_display = function(){
- if ($("#create-choice:checked").length){
+ if ($("#{{form.create_treatment.auto_id}}:checked").length){
$("#new-treatment").show();
} else {
$("#new-treatment").hide();
@@ -56,7 +54,7 @@ var update_form_display = function(){
}
$(document).ready(function(){
- $("#create-choice").click(update_form_display);
+ $("#{{form.create_treatment.auto_id}}").click(update_form_display);
update_form_display();
});
diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py
index 30a382e2c..e930c0830 100644
--- a/archaeological_finds/views.py
+++ b/archaeological_finds/views.py
@@ -633,6 +633,7 @@ class QAFindTreatmentFormView(QAItemForm):
def get_form_kwargs(self):
kwargs = super(QAFindTreatmentFormView, self).get_form_kwargs()
kwargs['user'] = self.request.user
+ kwargs['prefix'] = "qa-packaging"
return kwargs
def form_valid(self, form):
diff --git a/bootstrap_datepicker/widgets.py b/bootstrap_datepicker/widgets.py
index 9416ac16b..338319311 100644
--- a/bootstrap_datepicker/widgets.py
+++ b/bootstrap_datepicker/widgets.py
@@ -159,8 +159,8 @@ class DatePicker(DateTimeInput):
html = self.html_template % dict(div_attrs=flatatt(div_attrs),
input_attrs=flatatt(input_attrs),
icon_attrs=flatatt(icon_attrs))
- js = self.js_template % dict(picker_id=picker_id,
- options=json_dumps(self.options or {}))
+ js = self.js_template % dict(
+ picker_id=picker_id, options=json_dumps(self.options or {}))
return mark_safe(force_text(html + js))
diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py
index 2dec39c84..b52219c11 100644
--- a/ishtar_common/models_imports.py
+++ b/ishtar_common/models_imports.py
@@ -1058,8 +1058,8 @@ class Import(models.Model):
put_session_message(
session_key,
unicode(
- _(u"Modification check {} added to the queue")).format(
- self.name),
+ _(u"Modification check {} added to the queue")
+ ).format(self.name),
"info")
self.state = 'HQ'
self.end_date = datetime.datetime.now()
diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py
index b5e1f5891..6292db202 100644
--- a/ishtar_common/widgets.py
+++ b/ishtar_common/widgets.py
@@ -476,6 +476,10 @@ if settings.SURFACE_UNIT == 'square-metre':
AreaWidget = SquareMeterWidget
+class CheckboxInput(forms.CheckboxInput):
+ NO_FORM_CONTROL = True
+
+
class SearchWidget(forms.TextInput):
template_name = 'widgets/search_input.html'