diff --git a/django/didgeridoo/currencies/urls.py b/django/didgeridoo/currencies/urls.py index ef9dd3f..0ef97bf 100644 --- a/django/didgeridoo/currencies/urls.py +++ b/django/didgeridoo/currencies/urls.py @@ -1,10 +1,10 @@ from django.conf.urls import url -from currencies.views import currencies, CurrencyUpdate +from currencies.views import currencies, currency_update urlpatterns = [ url(r'^currencies/$', currencies), - url(r'^ajax/CurrencyUpdate/$', - CurrencyUpdate, - name='CurrencyUpdate'), + url(r'^ajax/currency_update/$', + currency_update, + name='currency_update'), ] diff --git a/django/didgeridoo/currencies/views.py b/django/didgeridoo/currencies/views.py index 0dcd960..86419ff 100644 --- a/django/didgeridoo/currencies/views.py +++ b/django/didgeridoo/currencies/views.py @@ -10,11 +10,11 @@ from currencies.forms import CurrencyForm from django.http import JsonResponse -def CurrencyUpdate(request): - currency = request.GET.get('CurrencyUpdate', None) +def currency_update(request): + currency = request.GET.get('currency_update', None) data = { - 'currency': ExchangeRate_name.objects.get( - currency).id + 'currency': ExchangeRate.objects.filter( + name__name=currency).latest('date') } print('currency: ', currency, 'data: ', data) return JsonResponse(data) diff --git a/django/didgeridoo/static/js/app.js b/django/didgeridoo/static/js/app.js index 90b51bc..e9dea69 100644 --- a/django/didgeridoo/static/js/app.js +++ b/django/didgeridoo/static/js/app.js @@ -1,7 +1,7 @@ - $("#CurrencyUpdate").change(function () { + $("#currency_update").change(function () { var currency = $(this).val(); $.ajax({ - url: '/ajax/CurrencyUpdate/', + url: '/ajax/currency_update/', data: { 'currency': currency }, diff --git a/django/didgeridoo/webshop/templates/webshop/nav.html b/django/didgeridoo/webshop/templates/webshop/nav.html index aa45224..f009520 100644 --- a/django/didgeridoo/webshop/templates/webshop/nav.html +++ b/django/didgeridoo/webshop/templates/webshop/nav.html @@ -22,7 +22,7 @@
{% csrf_token %} -