From 946321816a13cb608973850ec13459b0b0c15fd9 Mon Sep 17 00:00:00 2001 From: Horilla Date: Mon, 8 Sep 2025 12:26:44 +0530 Subject: [PATCH] [UPDT] HORILLA_VIEWS: Added custom empty template to card view --- horilla_views/generic/cbv/views.py | 2 ++ .../templates/generic/components.html | 13 +++++++++++ .../templates/generic/horilla_card.html | 23 +++++++++++-------- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/horilla_views/generic/cbv/views.py b/horilla_views/generic/cbv/views.py index 1b9342feb..e2c794d92 100644 --- a/horilla_views/generic/cbv/views.py +++ b/horilla_views/generic/cbv/views.py @@ -1646,6 +1646,7 @@ class HorillaCardView(ListView): records_per_page: int = 50 card_status_class: str = """""" card_status_indications: list = [] + custom_empty_template: str = "" def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) @@ -1707,6 +1708,7 @@ class HorillaCardView(ListView): context["show_filter_tags"] = self.show_filter_tags context["card_status_class"] = self.card_status_class context["card_status_indications"] = self.card_status_indications + context["custom_empty_template"] = self.custom_empty_template if self.show_filter_tags: data_dict = parse_qs(self._saved_filters.urlencode()) diff --git a/horilla_views/templates/generic/components.html b/horilla_views/templates/generic/components.html index 7a16fcd68..f59f7c9b2 100644 --- a/horilla_views/templates/generic/components.html +++ b/horilla_views/templates/generic/components.html @@ -32,6 +32,19 @@ + + + {% endif %} {% else %} -
-
- Page not found. 404. -

{% trans "No Records found" %}

-

- {% trans "No records found." %} -

-
-
+ + {% if custom_empty_template %} + {% include custom_empty_template %} + {% else %} +
+
+ Page not found. 404. +

{% trans "No Records found" %}

+

+ {% trans "No records found." %} +

+
+
+ {% endif %} {% endif %}