-
Notifications
You must be signed in to change notification settings - Fork 4
Hometask for lesson 6 #1
base: master
Are you sure you want to change the base?
Hometask for lesson 6 #1
Conversation
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
{% load static %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{% load static %}
лучше переместить наверх, сразу после extends. Такая конструкция сейчас валидна но если с этим кодом будут работать другие разработчики они могут не заметить что где то внутри уже был загружен модуль для работы статикой
templates/base.html
Outdated
<html> | ||
<head> | ||
<title>Книжный магазин</title> | ||
{% load static %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лишний пробел
main/templates/main/index.html
Outdated
<div class="book-preview__name">{{ book.name }}</div> | ||
<div class="spring"></div> | ||
<div class="book-preview__author">{{ book.author }}</div> | ||
<a href="/catalog/{{ book.id }}">Подробнее</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
На лекции я упустил. Есть шаблонный тег {% url ... %}, который решает эту проблем
main/templates/main/index.html
Outdated
<div> | ||
<div class="main"> | ||
<div class="main__book"> | ||
|
||
{% load static %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тоже самое что описал сверху
@@ -2,6 +2,7 @@ | |||
from django.shortcuts import render | |||
from catalog.data import BOOKS | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
<div class="main__book"> | ||
<div class="book-detail"> | ||
<div class="book-detail__cover book-detail-cover"> | ||
<img class="book-detail-cover__img" src="{% static "" %}/{{ book.cover }}" alt="Название книги" > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{% static "" %}/{{ book.cover }} -> {% static book.cover %}
…tatic img references corrected and {% url %} is used.
No description provided.