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})
{% 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 %}
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)