Implement view to update exchange rates
This commit is contained in:
parent
0d2d9a491a
commit
c7226ba94d
2 changed files with 17 additions and 0 deletions
5
urls.py
Normal file
5
urls.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from .views import RateUpdaterView
|
||||
|
||||
ADMIN_URLS = [
|
||||
("update/", RateUpdaterView.as_view(), "updater"),
|
||||
]
|
12
views.py
Normal file
12
views.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
from core.views.backend.generic import BackendRedirectView
|
||||
|
||||
from .helpers import update_currencies
|
||||
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
class RateUpdaterView(BackendRedirectView):
|
||||
next = reverse_lazy("currencies")
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
update_currencies()
|
||||
return super().dispatch(request, *args, **kwargs)
|
Loading…
Reference in a new issue