I think you want to use forloop.counter or forloop.counter0:
   forloop.counter:  The current iteration of the loop (1-indexed)
   forloop.counter0: The current iteration of the loop (0-indexed)

   http://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#for


Robert




On Wed, Feb 23, 2011 at 21:42, T K <[email protected]> wrote:
> ##PYTHON CODE
> userprofile = db.get(user_key)
> url_linktext = 'Logout'
> url = users.create_logout_url(self.request.uri)
> projects = userprofile.project_references      #projects are records from
> querying database.
> values = {
>             'projects': projects,
>             'numberprojects': userprofile.project_references.count(),
>             'pagename': pagename}
> self.response.out.write(template.render('showproject.html', values))
>
> #HTML
> {% for proj in projects %}
>           <tr class="odd" valign="middle">
>             <td><input type="checkbox" name="chkSelect"
> value="{{proj.key}}"></td>
>             <td>{{proj.projectname}}</td>
>             <td>{{proj.budget}}</td>
>             <td>{{proj.startdate}}</td>
>             <td>{{proj.enddate}}</td>
>             <td>{{proj.contactname}}</td>
>              <td>{{proj.contactnumber}}</td>
>           </tr>
>  {% endfor %}
> The problem is I want to add sequence into the projects object so that when
> it's replaced in the html template, I can use {{proj.sequence}}.
> but sequence is not a property in the database.
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" 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/google-appengine?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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/google-appengine?hl=en.

Reply via email to