Django.fun

How can I concadenate 2 queryset in django to write in xlwt excel file?

I have 2 models class, i have to concadenate these qeurysetobjects and write one excel page. how can i do it ? I use whis code but it doesnt work, It writes second queryset datas under another types of objets. like this :image

  def export_excel(request):

     response =HttpResponse(content_type = 'application/ms-excel')
     response['Content-Disposition'] = 'filename="persondatas.xls"' 
     wb = xlwt.Workbook(encoding='utf-8')
     ws = wb.add_sheet('AllinOne')
     row_num = 0
     font_style = xlwt.XFStyle()
     font_style.font.bold = True


     columns = ['name', 'fulname', 'id', 'gender', 'country', 'birthdate', 'birthpace', 
               'departament', 'feature']
     for col_num in range(len(columns)):
           ws.write(row_num, col_num, columns[col_num], font_style)

     font_style = xlwt.XFStyle()
     rows =Person.objects.values_list('name', 'lastname', 'selfid', 'gender', 'country', 
              'dateofbirth', 'placeofbirth')
     jobs = Enrollment.objects.values_list('departament', 'feature')
     querysets = [rows, jobs]
     rows = list(chain(*querysets))
    
     for row in rows: 
        row_num+=1
        for col_num in range(len(row)):
         ws.write(row_num, col_num, str(row[col_num]), font_style)


    wb.save(response)

Answers: 0