File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 44
55urlpatterns = [
66 path ("" , views .index , name = "index" ),
7+ path ("flow" , views .flow , name = "flow" ),
8+ path ("charts" , views .charts , name = "charts" ),
79]
Original file line number Diff line number Diff line change 1+ from collections import Counter
2+
13from django .shortcuts import render
24from django .http import HttpResponse
35
6+ from .models import Sales
47
58# Create your views here.
69
710
811def 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 })
You can’t perform that action at this time.
0 commit comments