Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
views.py

Python
from django.shortcuts import render

rooms = [

{'id': 1, 'name': 'Lets learn python'},

{'id': 2, 'name': 'Design with me'},

{'id': 3, 'name': 'Frontend development'},

]

def home(request):

context = {'rooms': rooms}

return render(request, 'base/home.html', {'context': context})



home.html

HTML
{% extends "main.html" %}

{% block content %}

<h1>Home Template</h1>

<div>

<div>

{% for room in rooms %}

<div>

<h5>{{room.id}} -- <a href="/room/{{room.id}}">{{room.name}}</a></h5>

</div>

{% endfor %}

</div>

</div>

{% endblock content %}


What I have tried:

when add new h tag outside for it have show out but when move in to for it no show out
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900