Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6388439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:16:43+00:00 2026-05-25T03:16:43+00:00

Semi-brief overview… — Indices is a Python list of indices that correspond to the

  • 0

Semi-brief overview…

— Indices is a Python list of indices that correspond to the total number of rows the HTML table will have. For example if the column has 5 rows the list would be [0, 1, 2, 3, 4].

— RowNames is a Python list of the individual names of the HTML table rows. For example [Title, Year, Author, Date, State]

— ColData is the data that will fill the HTML’s tables columns corresponding to the rows. For example [“Great Scott”, 1989, “James Bixby”, “12-4-2011”, “MA”]

Here is what I need to do…

{% for Index in Indices %} 
       <tr>
             <td width='11%' align='right'><strong>{{ RowNames.Index }}</strong></td>   
             <td width='89%' align='left'>{{ ColData.Index }}</td>      
      </tr>             
{% endfor %}     

However, Django does not interpret {{ RowNames.Index }} or {{ ColData.Index }} as the ith element of the list. How can I re-code what I have above so it is interpreted as the ith element of the list?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:16:44+00:00Added an answer on May 25, 2026 at 3:16 am

    You can access the index of the element via forloop.counter0 (see here).

    Ok, I remembered wrong. Basically you should approach the problem like this:
    either create list of objects or a list of tuples. Django does not support this for reason – the programming should not be done in the templates.

    Using python’s zip() function you can create a list of tuples with the following form: [(rowname, coldata), (rowname, coldata)…]

    mydata = zip(rowname_list, coldata_list)
    

    Now in your template you can iterate over each rowname and coldata like this:

    {% for rowname,coldata in mydata %}
    <tr>
        <td width='11%' align='right'><strong>{{ rowname }}</strong></td>   
        <td width='89%' align='left'>{{ coldata }}</td>      
    </tr>  
    {% endfor %}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

semi Resolved It appears that the problem exists only when running in debug mode,
I want to make a CAML query semi-smart - in that I can give
I've built a semi-push service (checkins for notifications from a centralized http server) that
I have a semi xml formatted file that contains line with the following format:
I am developing a semi-complicated site that is available in several countries at once.
There is a semi-famous article written by Guido himself hinting that reduce() should go
Is there a semi-transparent way that would make it easier to code in a
I have a semi-large web application that we run locally and I need to
I need to remove semi duplicate records from the following table ID PID SCORE
I have a semi-working example that you can look at. This appears to work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.