Hello,

I have the following errors: why append is not done?
AttributeError at /export_excel/ 

'int' object has no attribute 'append'

 Request Method: GET  Request URL: http://article/export_excel/  Django 
Version: 1.6.2  Exception Type: AttributeError  Exception Value: 

'int' object has no attribute 'append'

 Exception Location: /var/www/html/staff/views.py in export_excel, line 181  
Python 
Executable: /usr/bin/python  Python Version: 2.6.6  Python Path: 

['/usr/lib/python2.6/site-packages/pip-1.5.2-py2.6.egg',
 '/usr/lib64/python26.zip',
 '/usr/lib64/python2.6',
 '/usr/lib64/python2.6/plat-linux2',
 '/usr/lib64/python2.6/lib-tk',
 '/usr/lib64/python2.6/lib-old',
 '/usr/lib64/python2.6/lib-dynload',
 '/usr/lib64/python2.6/site-packages',
 '/usr/lib/python2.6/site-packages',
 '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info',
 '/var/www/html/ihttest/ihttcs_test/kojin',
 '/var/www/html/ihttest/ihttcs_test/kojin/static/']

 Server time: Wed, 21 May 2014 12:15:09 +0900  
Traceback Switch to copy-and-paste 
view<http://dev1.so2.co.jp/ihttest/ihttcs_test/export_excel/#> 
   
   - /usr/lib/python2.6/site-packages/django/core/handlers/base.py in 
   get_response 
   1. 
      
                          response = wrapped_callback(request, *callback_args, 
**callback_kwargs)
      
      ...
    ▶ Local vars <http://dev1.so2.co.jp/ihttest/ihttcs_test/export_excel/#> 
   - /var/www/html/staff/views.py in export_excel 
   1. 
      
              row[0][0].append(a)
      
      ...
    ▶ Local vars <http://dev1.so2.co.jp/ihttest/ihttcs_test/export_excel/#>
   

This is my 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)
    titles = 
["No","名前".encode("Shift_JIS"),"日付".encode("Shift_JIS"),"出勤時間".encode("Shift_JIS"),
 
"退勤>時間".encode("Shift_JIS")]
    writer.writerow(titles)
    obj_all = Myattendance.objects.filter(id = 1).values_list('user', 
'contact_date', 'contact_time').order_by("-contact_time")
    lea = Myleavework.objects.filter(id = 
1).values_list('contact_time').order_by('-contact_time')

    row = [[0 for i in range(5)] for i in range(31)]
    for a in obj_all.filter().values_list('user_id'):
        row[0][0].append(a)
    for b in obj_all.filter().values_list('contact_date'):
        row[0][1].append(b)
    for c in obj_all.filter().values_list('contact_time'):
        row[0][2].aapend(c)

        writer.writerow(row)
    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/6d23e2e5-397d-4ea6-aa48-0bbaddefc42e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to