Advertisement
Guest User

Untitled

a guest
Feb 27th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. def download_workbook(request):
  2. lists = family.objects.all()
  3. # your excel html format
  4. template_name = "sample_excel.html"
  5.  
  6. response = render_to_response(template_name, {'lists': lists})
  7. # this is the output file
  8. filename = "sample.xls"
  9.  
  10. response['Content-Disposition'] = 'attachment; filename='+filename
  11. response['Content-Type'] = 'application/vnd.ms-excel; charset=utf-16'
  12. return response
  13.  
  14. PERSONNEL_NUMBERR DEPENDT_FIRST_NAME1 DEPENDT_FAMILY_NAME DEPENDANT_TYPE DEPENDT_BIRTH_DATE DEPENDANT_SEQUENCE FAMILY_ID
  15. {% autoescape off %} {% for list in lists %}{{ str(list.member.personal_number) }} {{ list.dependent_first_name1 }} {{ list.dependent_family_name }} {{ list.dependent_type }} {{ list.dependent_birthdate }} {{ list.dependent_sequence }} {{ str(list.family_uid) }}
  16. {% endfor %}{% endautoescape %}
  17.  
  18. personal_number 000029
  19. family_uid 0000290001
  20.  
  21. personal_number 29
  22. family_uid 290001
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement