From 776f81b3c9b8f2304306227cbb064e309a6f7216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Ho=CC=88rler?= Date: Tue, 19 Dec 2017 21:28:05 +0100 Subject: [PATCH] testpush --- django/didgeridoo/currencies/index.html | 20 ------------------- django/didgeridoo/currencies/models.py | 10 ---------- .../templates/currencies/index.html | 19 ++++++++++++++++++ django/didgeridoo/currencies/urls.py | 4 ++-- django/didgeridoo/currencies/views.py | 17 +++++++++++++--- django/didgeridoo/didgeridoo/urls.py | 2 +- 6 files changed, 36 insertions(+), 36 deletions(-) delete mode 100644 django/didgeridoo/currencies/index.html create mode 100644 django/didgeridoo/currencies/templates/currencies/index.html diff --git a/django/didgeridoo/currencies/index.html b/django/didgeridoo/currencies/index.html deleted file mode 100644 index 41b4d61..0000000 --- a/django/didgeridoo/currencies/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - -
-

audioguide

-

a mobile offline audioguide

-noop -noop -noop -noop -noop -noop -

the audioguide that makes a offline usage possible.

-
- - - diff --git a/django/didgeridoo/currencies/models.py b/django/didgeridoo/currencies/models.py index 79e45c7..1edbe06 100644 --- a/django/didgeridoo/currencies/models.py +++ b/django/didgeridoo/currencies/models.py @@ -7,13 +7,3 @@ class ExchangeRate(models.Model): def __str__(self): return self.name - - def exchange_rates(): - exchange_rates = currencies.get_exchange_rate() - - for i in exchange_rates: - if ExchangeRate.objects.filter( - name='exchange_rates_data[dictionary_value]'): - ExchangeRate.objects.filter( - name='exchange_rates_data[dictionary_key]', - exchange_rate_to_chf=exchange_rates.value).save() diff --git a/django/didgeridoo/currencies/templates/currencies/index.html b/django/didgeridoo/currencies/templates/currencies/index.html new file mode 100644 index 0000000..edfd456 --- /dev/null +++ b/django/didgeridoo/currencies/templates/currencies/index.html @@ -0,0 +1,19 @@ + + + + + +
+

Music Shop

+ {% if currency_list %} + + {% else %} +

No categories are available.

+ {% endif %} +
+ + diff --git a/django/didgeridoo/currencies/urls.py b/django/didgeridoo/currencies/urls.py index a3780aa..2804c74 100644 --- a/django/didgeridoo/currencies/urls.py +++ b/django/didgeridoo/currencies/urls.py @@ -1,7 +1,7 @@ from django.conf.urls import url +from currencies.views import currencies -from . import views urlpatterns = [ - url(r'^$', views.index, name='index'), + url(r'^currencies/$', currencies), ] diff --git a/django/didgeridoo/currencies/views.py b/django/didgeridoo/currencies/views.py index 47d054b..7926760 100644 --- a/django/didgeridoo/currencies/views.py +++ b/django/didgeridoo/currencies/views.py @@ -1,7 +1,18 @@ from django.shortcuts import render -from django.http import HttpResponse +from .models import ExchangeRate import exchange_rates -def index(request): - return HttpResponse(exchange_rates) +def currencies(request): + # return HttpResponse("exchange_rates") + currency_list = ExchangeRate.objects.all() + raw_data = exchange_rates.get_exchange_rate() + + for i, j in raw_data.items: + ExchangeRate.objects.create( + name=i, + exchange_rate_to_chf=j) + + return render(request, + 'currencies/index.html', + {'currency_list': currency_list}) diff --git a/django/didgeridoo/didgeridoo/urls.py b/django/didgeridoo/didgeridoo/urls.py index 1eef47b..a9524c5 100644 --- a/django/didgeridoo/didgeridoo/urls.py +++ b/django/didgeridoo/didgeridoo/urls.py @@ -18,6 +18,6 @@ from django.contrib import admin urlpatterns = [ url(r'', include('webshop.urls')), - url(r'^admin/', admin.site.urls), + url(r'', include('currencies.urls')), url(r'^admin/', admin.site.urls), ]