Home > Net >  html h1 tag no show type
html h1 tag no show type

Time:11-17

after click no.1 and blank to than page it no show h1 tag

enter image description here

inspect here

enter image description here

code html here

{% extends "main.html" %}

{% block content %}
<h1>{{room.name}}</h1>

{% endblock content %}

code python here i don't know this have problem or not

from django.shortcuts import render

rooms = [
    {'id': 1, 'name': 'Lets learn python!'},
    {'id': 2, 'name': 'Design with me!'},
    {'id': 3, 'name': 'Fronted develpoers!'},
]


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


def room(request, pk):
    room = None
    for i in rooms:
        if i['id'] == int(pk):
            room = i
    context = {'romm': room}
    return render(request, 'base/room.html', context)

CodePudding user response:

I think you mispelled room context.

instead of this:

<h1>{{room.name}}</h1>

Try this:

<h1>{{romm.name}}</h1>
  • Related