Skip to content
This repository has been archived by the owner on Oct 16, 2019. It is now read-only.

Hometask for lesson 6 #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Hometask for lesson 6 #1

wants to merge 2 commits into from

Conversation

AleksandrTsimbulov
Copy link

No description provided.

{% extends 'base.html' %}

{% block content %}
{% load static %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{% load static %} лучше переместить наверх, сразу после extends. Такая конструкция сейчас валидна но если с этим кодом будут работать другие разработчики они могут не заметить что где то внутри уже был загружен модуль для работы статикой

<html>
<head>
<title>Книжный магазин</title>
{% load static %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лишний пробел

<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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На лекции я упустил. Есть шаблонный тег {% url ... %}, который решает эту проблем

<div>
<div class="main">
<div class="main__book">

{% load static %}
Copy link
Contributor

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


Copy link
Contributor

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="Название книги" >
Copy link
Contributor

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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants