Implement view to update exchange rates

This commit is contained in:
Kumi 2020-06-10 13:44:57 +02:00
parent 0d2d9a491a
commit c7226ba94d
2 changed files with 17 additions and 0 deletions

5
urls.py Normal file
View file

@ -0,0 +1,5 @@
from .views import RateUpdaterView
ADMIN_URLS = [
("update/", RateUpdaterView.as_view(), "updater"),
]

12
views.py Normal file
View 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)