Skip to content

Commit 56e1b5b

Browse files
committed
Update Routing
1 parent e07ccd6 commit 56e1b5b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

apps/home/urls.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44

55
urlpatterns = [
66
path("", views.index, name="index"),
7+
path("flow", views.flow, name="flow"),
8+
path("charts", views.charts, name="charts"),
79
]

apps/home/views.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1+
from collections import Counter
2+
13
from django.shortcuts import render
24
from django.http import HttpResponse
35

6+
from .models import Sales
47

58
# Create your views here.
69

710

811
def index(request):
912
# Page from the theme
1013
return render(request, "pages/index.html")
14+
15+
def flow(request):
16+
# Page from the theme
17+
return render(request, "pages/reactflow.html")
18+
19+
def charts(request):
20+
countries = list(Sales.objects.values_list('country', flat=True))
21+
country_counts = Counter(countries)
22+
country_count = [{'country': country, 'count': country_counts[country]} for country in country_counts]
23+
return render(request, "pages/recharts.html", {"country_count": country_count})

0 commit comments

Comments
 (0)