[Answered ]-Django ListView how to zip context data with another context

1👍

Got it I needed to zip object_list inside the original context ListView context looks like this:

 {'paginator': None, 'page_obj': None, 'is_paginated': False,
 'object_list': <QuerySet [<Weather: 2021-04-06 14:34:32.895936+00:00>,
                            <Weather: 2021-04-06 20:40:00.304090+00:00>,
                            <Weather: 2021-04-07 04:24:39.292096+00:00>]>,
'weather_list': <QuerySet [<Weather: 2021-04-06 14:34:32.895936+00:00>,
                            <Weather: 2021-04-06 20:40:00.304090+00:00>,
                            <Weather: 2021-04-07 04:24:39.292096+00:00>]>,
'view': <frontend.views.WeatherListView object at 0x7f4ec824b3d0>}

my new context is:

context = {
            "object_list": zip(data["object_list"], temp_list_compared, humidity_list_compared)
        }

Leave a comment