Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

347
Views
Django for loop to display all objects in database
def homepage(response):
    data = Project_types.objects.all()
    return render(response, 'main/homepage.html',{'projects':data})


def hacks(response):
    return render(response, 'main/hacks.html', {})

def games(response):
    return render(response, 'main/games.html', {})

All I need to know is how to iterate through each object in the variable "data" in html. I want it displayed in the most simple way possible !

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Using the FOR template tags you can iterate through the objects in the data list ...

templatename.html:

{% for iteratorname in projects %}
    <h1> {{ iteratorname.attributes }} </h1>
{% endfor %}

Please read the documentation for more details

over 4 years ago · Santiago Trujillo Report

0

You can use for template tag:

{% for project in projects %}
    <p> {{project.attributes}} </p>
{% endfor %}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!