#Beginner - Help with templates
1 messages · Page 1 of 1 (latest)
`{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{% block title %} Homepage {% endblock %}</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{% static 'css/style.css' %}">
</head>
<body>
<header class="header">
<a data-hover="Salut" href="{% url 'home' %}" class="nav-item">Home</a>
<a data-hover="Salut" href="{% url 'photos' %}" class="nav-item">Photos</a>
</header>
{% block content %}
{% endblock %}
</body>
</html>`
this is the base or the master html
and this is some other page
`{% extends 'master.html' %}
{% block content %}
<p>salut ionut</p>
{% endblock %} `
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{% block title %} Homepage {% endblock %}</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{% static 'css/style.css' %}">
</head>
<body>
<header class="header">
<a data-hover="Salut" href="{% url 'home' %}" class="nav-item">Home</a>
<a data-hover="Salut" href="{% url 'photos' %}" class="nav-item">Photos</a>
</header>
{% block content %}
{% endblock %}
</body>
</html>
Looks right so far
Yea that's what I'm saying, it's weird
What exactly is weird? What you did with templates and what happened?
Urls
`from django.contrib import admin
from django.urls import path
from photos import views
urlpatterns = [
path('admin/', admin.site.urls),
path('photos/', views.photos_list, name='photos'),
path('', views.home_page, name='home'),
]
`
Views
def home_page(request): return render(request, 'master.html')
So basically i just want to create a base html, with a navbar and footer
and then create other pages based on that base html
like components
wait a second
I think i got it
Nvm got it
forgot to change it in the urls
and views