From 2879fde49191e4365634a2249fac3d6e64737557 Mon Sep 17 00:00:00 2001 From: Horilla Date: Mon, 23 Jun 2025 11:15:32 +0530 Subject: [PATCH] [UPDT] HORILLA_AUTOMATIONS: Updated horilla_automations app by merge with latest style --- horilla_automations/models.py | 10 +++++++ .../horilla_automations/detail_action.html | 27 +++++++++++++++++++ horilla_automations/views/cbvs.py | 26 ++---------------- 3 files changed, 39 insertions(+), 24 deletions(-) create mode 100644 horilla_automations/templates/horilla_automations/detail_action.html diff --git a/horilla_automations/models.py b/horilla_automations/models.py index 967aaf579..c78884f2b 100644 --- a/horilla_automations/models.py +++ b/horilla_automations/models.py @@ -123,6 +123,16 @@ class MailAutomation(HorillaModel): "horilla_automations/mail_cc.html", {"employees": employees} ) + def detail_actions(self): + """ + This method for get custom column for actions. + """ + + return render_template( + path="horilla_automations/detail_action.html", + context={"instance": self}, + ) + def detailed_url(self): return reverse("automation-detailed-view", kwargs={"pk": self.pk}) diff --git a/horilla_automations/templates/horilla_automations/detail_action.html b/horilla_automations/templates/horilla_automations/detail_action.html new file mode 100644 index 000000000..86cee50a3 --- /dev/null +++ b/horilla_automations/templates/horilla_automations/detail_action.html @@ -0,0 +1,27 @@ +{% load static i18n %} +{% if perms.horilla_automations.change_mailautomation %} + + + +{% endif %} + +{% if perms.horilla_automations.delete_mailautomation %} + +
+ {% csrf_token %} + +
+ +{% endif %} \ No newline at end of file diff --git a/horilla_automations/views/cbvs.py b/horilla_automations/views/cbvs.py index c55ec2af1..692353e1b 100644 --- a/horilla_automations/views/cbvs.py +++ b/horilla_automations/views/cbvs.py @@ -194,7 +194,7 @@ class AutomationDetailedView(views.HorillaDetailedView): """ model = models.MailAutomation - title = "Detailed View" + title = _("Details") header = { "title": "title", "subtitle": "title", @@ -207,29 +207,7 @@ class AutomationDetailedView(views.HorillaDetailedView): ("Mail Cc", "get_mail_cc_display"), ("Trigger", "trigger_display"), ] - actions = [ - { - "action": "Edit", - "icon": "create-outline", - "attrs": """ - hx-get="{edit_url}?instance_ids={ordered_ids}" - hx-target="#genericModalBody" - data-toggle="oh-modal-toggle" - data-target="#genericModal" - class="oh-btn oh-btn--info w-50" - """, - }, - { - "action": "Delete", - "icon": "trash-outline", - "attrs": """ - class="oh-btn oh-btn--danger w-50" - onclick=" - confirm('Do you want to delete the automation?','{delete_url}') - " - """, - }, - ] + action_method = "detail_actions" @method_decorator(login_required, name="dispatch")