Hello, I want to export csv from the two objects I have the erroe is here: Exception Type: AttributeError Exception Value:
'QuerySet' object has no attribute 'id' This is my the views.py : def export_excel(request): response = HttpResponse(mimetype='application/vnd.ms-excel; charset="Shift_JIS"') response['Content-Disposition'] = 'attachment; filename=file.csv' writer = csv.writer(response) writer.writerow(["No","name", "date", "time"]), obj_all=set([attendance.objects.all()]) l_all = set([leavework.objects.all()]) # all = obj_all | l_all A = obj_all B = l_all for obj in A: row = [] # all = row for field in attendance._meta.fields: row.append(unicode(getattr(obj,field.name)).encode("cp932")) for leave in B: for field in leavework._meta.fields: row.append(unicode(getattr(leave, field.name)).encode("cp932")) for all in row: writer.writerow(all) return response -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0956916e-de09-411e-9df0-4f3e2cf1d3ec%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.