From 21c5150f6f2fd3123ff1e3830b85128f36d44c16 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 9 Mar 2023 18:13:32 +0000 Subject: [PATCH] Allow fetching bank details from currencies page --- app/urls.py | 5 +++++ core/views/banks.py | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/app/urls.py b/app/urls.py index a4ddc3d..f8da157 100644 --- a/app/urls.py +++ b/app/urls.py @@ -99,6 +99,11 @@ urlpatterns = [ aggregators.RequestBankFetch.as_view(), name="bank_fetch", ), + path( + "ops/bank_fetch/", + aggregators.RequestBankFetch.as_view(), + name="bank_fetch", + ), # Bank details by currency path( "banks//details/", diff --git a/core/views/banks.py b/core/views/banks.py index 3d409f9..331d2bf 100644 --- a/core/views/banks.py +++ b/core/views/banks.py @@ -1,4 +1,5 @@ from django.contrib.auth.mixins import LoginRequiredMixin +from django.urls import reverse from mixins.views import ObjectList from two_factor.views.mixins import OTPRequiredMixin @@ -24,6 +25,19 @@ class BanksCurrencies(LoginRequiredMixin, OTPRequiredMixin, ObjectList): list_url_name = "currencies" list_url_args = ["type"] + def get_context_data(self): + context = super().get_context_data() + self.extra_buttons = [ + { + "url": reverse("bank_fetch"), + "action": "refresh", + "method": "get", + "label": "Fetch account details", + "icon": "fa-solid fa-refresh", + }, + ] + return context + def get_queryset(self, **kwargs): aggregators = Aggregator.objects.filter(user=self.request.user, enabled=True)