Allow fetching bank details from currencies page

This commit is contained in:
Mark Veidemanis 2023-03-09 18:13:32 +00:00
parent 35ffa036ae
commit 21c5150f6f
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 19 additions and 0 deletions

View File

@ -99,6 +99,11 @@ urlpatterns = [
aggregators.RequestBankFetch.as_view(), aggregators.RequestBankFetch.as_view(),
name="bank_fetch", name="bank_fetch",
), ),
path(
"ops/bank_fetch/",
aggregators.RequestBankFetch.as_view(),
name="bank_fetch",
),
# Bank details by currency # Bank details by currency
path( path(
"banks/<str:type>/details/", "banks/<str:type>/details/",

View File

@ -1,4 +1,5 @@
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse
from mixins.views import ObjectList from mixins.views import ObjectList
from two_factor.views.mixins import OTPRequiredMixin from two_factor.views.mixins import OTPRequiredMixin
@ -24,6 +25,19 @@ class BanksCurrencies(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
list_url_name = "currencies" list_url_name = "currencies"
list_url_args = ["type"] 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): def get_queryset(self, **kwargs):
aggregators = Aggregator.objects.filter(user=self.request.user, enabled=True) aggregators = Aggregator.objects.filter(user=self.request.user, enabled=True)