Hallo

For a reason I had to customize the Manager class of a model:

class QueueManager(models.Manager):
    def usedInputs(self, id):
        from django.db import connection
        cursor = connection.cursor()
        cursor.execute("""
           SELECT * FROM usedInput WHERE jobID=%s""" % id)
        result_list = []
        for row in cursor.fetchall():
            result_list.append(row)
        return result_list

This function returns a list of tuples. The I define a view function:

def inputs(request, id):
    q_list = Usedinput.objects.usedInputs(id)
    return render_to_response(
        'usedInputs/inputs.html', {'q_list': q_list}

And in a template I woud present the list elements in a table:

{% if q_list %}
 <table>
   <tr>
     <td>jobID</td>
     <td>processorID</td>
     <td>datasetID</td>
     <td>filename</td>
     <td>fileVersion</td>
   </tr>
   <br />
   {% for input in q_list %}
     <tr>
      <td>{{ input[0][0] }}</td>
      <td>{{ input[0][1] }}</td>
      <td>{{ input[0][2] }}</td>
      <td>{{ input[0][3] }}</td>
      <td>{{ input[0][4] }}</td>
     </tr>
   {% endfor %}
 </table>
{% endif %}

But in template we could not present the value as "input[0][0]". Would
somebody give me a solution of this problem?

Regards,
Nader
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to