diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-07-08 00:56:55 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-07-08 00:56:55 +0200 |
commit | 3586f706b1ea5e36009e5db59a8db7eb71ca50a4 (patch) | |
tree | f7b0823f41f8ffbed93e018bda8526c0f7b34283 | |
parent | 31b7b29906d8534ccc6318793750ad51650c12a2 (diff) | |
download | Ishtar-3586f706b1ea5e36009e5db59a8db7eb71ca50a4.tar.bz2 Ishtar-3586f706b1ea5e36009e5db59a8db7eb71ca50a4.zip |
Add Open/Close criteria for Operations (refs #429)
-rw-r--r-- | ishtar/ishtar_base/forms_operations.py | 1 | ||||
-rw-r--r-- | ishtar/ishtar_base/views.py | 4 | ||||
-rw-r--r-- | ishtar/templates/sheet_operation.html | 4 |
3 files changed, 6 insertions, 3 deletions
diff --git a/ishtar/ishtar_base/forms_operations.py b/ishtar/ishtar_base/forms_operations.py index 7274e66b5..1df0b16bb 100644 --- a/ishtar/ishtar_base/forms_operations.py +++ b/ishtar/ishtar_base/forms_operations.py @@ -189,6 +189,7 @@ class OperationSelect(forms.Form): remains = forms.ChoiceField(label=_("Remains"), choices=models.RemainType.get_types()) year = forms.IntegerField(label=_("Year")) + end_date = forms.NullBooleanField(label=_(u"Is open?")) def __init__(self, *args, **kwargs): super(OperationSelect, self).__init__(*args, **kwargs) diff --git a/ishtar/ishtar_base/views.py b/ishtar/ishtar_base/views.py index fcacc305a..e32b9dba5 100644 --- a/ishtar/ishtar_base/views.py +++ b/ishtar/ishtar_base/views.py @@ -427,7 +427,9 @@ def autocomplete_operation(request, non_closed=True): for operation in operations]) return HttpResponse(data, mimetype='text/plain') -get_operation = get_item(models.Operation, 'get_operation', 'operation') +get_operation = get_item(models.Operation, 'get_operation', 'operation', + bool_fields = ['end_date__isnull'], + extra_request_keys={'end_date':'end_date__isnull'}) show_operation = show_item(models.Operation, 'operation') revert_operation = revert_item(models.Operation) diff --git a/ishtar/templates/sheet_operation.html b/ishtar/templates/sheet_operation.html index 1b6755385..0005ca82c 100644 --- a/ishtar/templates/sheet_operation.html +++ b/ishtar/templates/sheet_operation.html @@ -13,8 +13,8 @@ <p><label>{%trans "Edition date:"%}</label> <span class='value'>{{ item.history.all.0.history_date }}</span></p> <!-- date = now --> -<p><label>{%trans "Begining date:"%}</label> <span class='value'>{{ item.start_date }}</span></p> -<p><label>{%trans "Field work end date:"%}</label> <span class='value'>{{ item.end_date|default:"-" }}</span></p> +{% if item.start_date %}<p><label>{%trans "Begining date:"%}</label> <span class='value'>{{ item.start_date }}</span></p>{%endif%} +{% if item.end_date %}<p><label>{%trans "Field work end date:"%}</label> <span class='value'>{{ item.end_date|default:"-" }}</span></p>{%endif%} <p><label>{%trans "Head scientist:"%}</label> <span class='value'>{{ item.in_charge.full_label }}</span></p> <p><label>{%trans "State:"%}</label> <span class='value'>{% if item.is_active %}{%trans "Active file"%}</span></p> |