From 707e0f9edcde92c47cd543325187e9e13b9ef43f Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 26 Jun 2024 10:16:18 +0200 Subject: ✨ criteria search: adapt searches for relative search (dates and numbers) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/forms_common.py | 9 +++------ ishtar_common/models.py | 30 +++++++++--------------------- 2 files changed, 12 insertions(+), 27 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 261bba4af..479d98315 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -2559,12 +2559,9 @@ class DocumentSelect(HistorySelect): ) town = get_town_field() area = widgets.Select2SimpleField(label=_("Area")) - receipt_date__before = DateField(label=_("Receipt date before")) - receipt_date__after = DateField(label=_("Receipt date after")) - creation_date__before = DateField(label=_("Creation date before")) - creation_date__after = DateField(label=_("Creation date after")) - receipt_date_in_documentation__before = DateField(label=_("Receipt date before")) - receipt_date_in_documentation__after = DateField(label=_("Receipt date after")) + receipt_date = DateField(label=_("Receipt date")) + creation_date = DateField(label=_("Creation date")) + receipt_date_in_documentation = DateField(label=_("Receipt date")) TYPES = [ FieldType("source_type", models.SourceType), diff --git a/ishtar_common/models.py b/ishtar_common/models.py index c14d59920..231d073e3 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -4459,31 +4459,19 @@ class Document( pgettext_lazy("key for text search", "has-file"), "associated_file__isnull", ), - "receipt_date__before": SearchAltName( - pgettext_lazy("key for text search", "receipt-date-before"), - "receipt_date__lte", + "receipt_date": SearchAltName( + pgettext_lazy("key for text search", "receipt-date"), + "receipt_date", ), - "receipt_date__after": SearchAltName( - pgettext_lazy("key for text search", "receipt-date-after"), - "receipt_date__gte", - ), - "receipt_date_in_documentation__before": SearchAltName( + "receipt_date_in_documentation": SearchAltName( pgettext_lazy( - "key for text search", "receipt-in-documentation-date-before" + "key for text search", "receipt-in-documentation-date" ), - "receipt_date_in_documentation__lte", - ), - "receipt_date_in_documentation__after": SearchAltName( - pgettext_lazy("key for text search", "receipt-in-documentation-date-after"), - "receipt_date_in_documentation__gte", - ), - "creation_date__before": SearchAltName( - pgettext_lazy("key for text search", "creation-date-before"), - "creation_date__lte", + "receipt_date_in_documentation", ), - "creation_date__after": SearchAltName( - pgettext_lazy("key for text search", "creation-date-after"), - "creation_date__gte", + "creation_date": SearchAltName( + pgettext_lazy("key for text search", "creation-date"), + "creation_date", ), "shooting_angle": SearchAltName( pgettext_lazy("key for text search", "shooting-angle"), -- cgit v1.2.3