figured it out on the IRC channel....i basically just needed to modify
my view as follows to make it work
def results(request):
select = request.GET.getlist('select')
results = Warranty.objects.filter(id__in=select)
return render_to_response('admin/report_list.html',
{'results':results, 'select':select})
On Mar 23, 2:37 pm, "Blake M. Sisco" <[email protected]> wrote:
> ok i am having an issue getting getlist() to work properly. it displays the
> correct number of rows in the template but there is not any data in those
> rows. firebug shows the following:
> *Request Headers*
> Host: wartrac.lormfg.com
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7)
> Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Referer:http://wartrac.lormfg.com/tracker/reports/
> Cookie:
> __utma=244144280.546994815381888600.1236088196.1236959460.1237809098.5;
> __utmz=244144280.1236088196.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
> __utma=163233722.3787547215650610000.1236361989.1236361989.1236361989.1;
> __utmz=163233722.1236361989.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
> sessionid=96ae590c0ec429724113fdbb8d6da83d; __utmc=244144280
> Cache-Control: max-age=0
> *
> Response Headers*
> Date: Mon, 23 Mar 2009 18:29:16 GMT
> Server: Apache
> Content-Type: text/html; charset=utf-8
> Connection: close
> Transfer-Encoding: chunked
>
> *Params*
> *select* 42 (this is the correct item based on my selection from the form)
>
> if someone could show/tell me where i'm going wrong i would appreciate it.
> Below are my views .py, report.html and report_list.html
>
> views.py
> from django.shortcuts import render_to_response
>
> from models import
> Warranty
>
> from django.http import
> *
>
> def
> index(request):
>
> open_warranty_list =
> Warranty.objects.all().order_by('date_ent')
>
> return render_to_response('tracker/index.html', {'open_warranty_list':
> open_warranty_list})
>
> def
> report_view(request):
>
> SelectForm =
> Warranty.objects.all().order_by('id')
>
> return
> render_to_response('admin/report.html',{'SelectForm':SelectForm})
>
> def
> results(request):
>
> if 'select' in request.GET and
> request.GET['select']:
>
> results = request.GET.getlist("select")
>
> return
> render_to_response('admin/report_list.html',{'results':results})
>
> else:
>
> return render_to_response('admin/report.html', {'error':True})
>
> ~
>
> report.html
> <form action="/tracker/results/" method="GET">
> <table cellspacing="0">
> <thead>
> <tr>
> <th></th>
> <th>QI</th>
> <th>Part No.</th>
> <th>Serial No.</th>
> <th>Date Entered</th>
> <th>Warranty</th>
> <th>Desc.</th>
> {%ifequal result.desc "Other"%}
> <th> Other</th>
> {%endifequal%}
> <th>Comments</th>
> </tr>
> <tbody>
> {%for warranty in SelectForm %}
> <tr class="{%cycle 'row1' 'row2' %}">
> <td> <input type="checkbox" id="id_select_{{warranty.id}}"
> value="{{warranty.id}}" name="select" /></td>
> <td> {{warranty.q_i_n}}</td>
> <td> {{warranty.p_no}}</td>
> <td> {{warranty.s_no}}</td>
> <td> {{warranty.date_ent}}</td>
> <td>{%ifequal warranty.warranty 0
> %}No{%else%}Yes{%endifequal%}</td>
> <td> {{warranty.get_desc_display}}</td>
> {%ifequal warranty.desc "Other"%}
> <td> {{warranty.other}}</td>
> {%endifequal%}
> <td > {{warranty.comment}}</td>
> </tr>
> {%endfor%}
> </table>
> <div><input type="submit" value="Results"/></div>
> </form>
> report_list.html
> {% if select %}
> <table cellspacing="0">
> <thead>
> <tr>
> <th>QI</th>
> <th>Part No.</th>
> <th>Serial No.</th>
> <th>Date Entered</th>
> <th>Warranty</th>
> <th>Desc.</th>
> {%ifequal data.desc "Other"%}
> <th> Other</th>
> {%endifequal%}
> <th>Comments</th>
> </tr>
> <tbody>
> {%for select in results %}
> <tr class="{%cycle 'row1' 'row2' %}">
> <td> {{select.q_i_n}}</td>
> <td> {{select.p_no}}</td>
> <td> {{select.s_no}}</td>
> <td> {{select.date_ent}}</td>
> <td>{%ifequal select.warranty 0 %}No{%else%}Yes{%endifequal%}</td>
> <td> {{select.get_desc_display}}</td>
> {%ifequal select.desc "Other"%}
> <td> {{select.other}}</td>
> {%endifequal%}
> <td> {{select.comment}}</td>
> </tr>
> {%endfor%}
> </table>
> Blake M. Sisco
> LOR Manufacturing Co., Inc
> Web Presence • Graphic Designwww.lormfg.com
> (866) 644-8622
> (888) 524-6292 FAX
>
> The information transmitted by Blake Sisco herewith is intended only for the
> person or entity to which it is addressed and may contain confidential
> and/or privileged material. Any review, retransmission, dissemination or
> other use of, or taking of any action in reliance upon, this information by
> persons or entities other than the intended recipient is prohibited. If you
> received this in error, please contact the sender and delete the material
> from any computer
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---