29 - Aggregating Data for HTML Table and ChartJS - Django | DRF | React w. Data Analysis

Опубликовано: 17 Февраль 2026
на канале: Sugarloaf And a Cup of Joe
545
4

Useful links:
https://docs.djangoproject.com/en/3.1...
https://docs.python.org/3/library/jso...
https://www.w3schools.com/js/js_json_...
https://www.chartjs.org/

About this video:
In this video we are going through my code (which was already written due to time constraints) where I gather data for context that will be used in tables and charts. Fun stuff.

Video Content:
00:00 Intro
00:54 Start preparing data in GET part of airpollution view
03:11 Using Sum aggregation
05:01 Using count aggregation
05:46 Putting results into nested dicts separately for table and charts
07:38 Debugging to see what the dicts look like
08:51 Postprocess visuals_data dict to add colouring to ChartsJS
11:24 Use colorsys hsv_to_rgb function
11:43 Use map with lambda function
12:43 Prepare RGB strings for ChartJS
14:43 Debug visuals_data to see what data it stores
15:41 Serialize visuals_data lists (labels, data, background and border lists) to then use them as JS arrays
17:03 Debug final context data


About this tutorial:
The primary goal of this tutorial is to take you through the steps of creating a solid Django portfolio project that will stand out when you talk to your future employer.
Check out tutorial's intro to see if it's something for you:
   • 01 - Introduction to the course - Django -...  

Tutorial repo:
https://github.com/SugarloafAndACupOf...

Please hit SUBSCRIBE if you wanna get the notifications about the new content!
Also, like the hell out of this video if you find it useful/interesting!
Follow us on Facebook:   / sugarloaf-and-a-cup-of-joe-101638761829670  
and Instagram:   / sugarloaf_and_a_cup_of_joe