From 73056b1ecaa1562ac2fdeb89a14c91604560b0e8 Mon Sep 17 00:00:00 2001 From: Max Filenko Date: Wed, 31 May 2017 10:57:51 +0200 Subject: [PATCH] Add data URLs --- dzbank/urls.py | 6 +++- dzbank/views.py | 73 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/dzbank/urls.py b/dzbank/urls.py index cb35d1e..a0623fd 100644 --- a/dzbank/urls.py +++ b/dzbank/urls.py @@ -21,7 +21,11 @@ urlpatterns = [ url(r'^$', TemplateView.as_view(template_name='index.html')), url(r'^import/$', import_depot, name="import-depot"), - url(r'^d/chart1/$', chart1, name="d_chart1"), + url(r'^data/allocation/portfolio/current/$', current_portfolio_data, name="current-portfolio-data"), + url(r'^data/allocation/portfolio/conservative/$', conservative_portfolio_data, name="conservative-portfolio-data"), + url(r'^data/allocation/portfolio/balanced/$', balanced_portfolio_data, name="balanced-portfolio-data"), + url(r'^data/allocation/portfolio/bold/$', bold_portfolio_data, name="bold-portfolio-data"), + url(r'^data/simulation/$', simulation_data, name="simulation-data"), url(r'^simulation/$', simulation, name="simulation"), url(r'^admin/', admin.site.urls), ] diff --git a/dzbank/views.py b/dzbank/views.py index fb3cb38..f716d50 100644 --- a/dzbank/views.py +++ b/dzbank/views.py @@ -9,8 +9,79 @@ def import_depot(request): def simulation(request): return render(request, 'simulation.html', {}) +def current_portfolio_data(request): + return JsonResponse([{ + 'name': 'Installation', + 'data': [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175] + }, { + 'name': 'Manufacturing', + 'data': [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434] + }, { + 'name': 'Sales & Distribution', + 'data': [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387] + }, { + 'name': 'Project Development', + 'data': [None, None, 7988, 12169, 15112, 22452, 34400, 34227] + }, { + 'name': 'Other', + 'data': [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111] + }], safe=False) + +def conservative_portfolio_data(request): + return JsonResponse([{ + 'name': 'Installation', + 'data': [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175] + }, { + 'name': 'Manufacturing', + 'data': [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434] + }, { + 'name': 'Sales & Distribution', + 'data': [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387] + }, { + 'name': 'Project Development', + 'data': [None, None, 7988, 12169, 15112, 22452, 34400, 34227] + }, { + 'name': 'Other', + 'data': [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111] + }], safe=False) + +def balanced_portfolio_data(request): + return JsonResponse([{ + 'name': 'Installation', + 'data': [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175] + }, { + 'name': 'Manufacturing', + 'data': [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434] + }, { + 'name': 'Sales & Distribution', + 'data': [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387] + }, { + 'name': 'Project Development', + 'data': [None, None, 7988, 12169, 15112, 22452, 34400, 34227] + }, { + 'name': 'Other', + 'data': [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111] + }], safe=False) + +def bold_portfolio_data(request): + return JsonResponse([{ + 'name': 'Installation', + 'data': [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175] + }, { + 'name': 'Manufacturing', + 'data': [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434] + }, { + 'name': 'Sales & Distribution', + 'data': [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387] + }, { + 'name': 'Project Development', + 'data': [None, None, 7988, 12169, 15112, 22452, 34400, 34227] + }, { + 'name': 'Other', + 'data': [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111] + }], safe=False) -def chart1(request): +def simulation_data(request): return JsonResponse([{ 'name': 'Installation', 'data': [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]