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

HW_6 teamplates #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 13 additions & 33 deletions catalog/templates/catalog/detail.html
Original file line number Diff line number Diff line change
@@ -1,45 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<title>Книжный магазин</title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
</head>
<body>
<header>
<nav class="nav">
<a href="#" class="nav__bar fa fa-solid bar"></a>
<a href="/" class="nav__logo">Книжный магазин</a>
<div class="spring"></div>
<a href="#" class="nav__basket fa fa-solid basket"></a>
</nav>
</header>
<main>
{% extends 'base.html' %}
{% load static %}

{% block content %}
<div>
<div class="main">
<div class="main__book">
<div class="book-detail">
<div class="book-detail__cover book-detail-cover">
<img class="book-detail-cover__img" src="/static/books/lutz.png" alt="Название книги" >
<img class="book-detail-cover__img" src={% static book.cover %} alt="Название книги" >
</div>
<div class="book-detail__content">
<div class="book-detail-property">Название: <i>Нащвние книги</i></div>
<div class="book-detail-property">Название на английском: <i>Book name</i></div>
<div class="book-detail-property">Автор: <i>Автор</i></div>
<div class="book-detail-property">Количество страниц: <i>256</i></div>
<div class="book-detail-property">Год выпуска: <i>2018</i></div>
<div class="book-detail-description">Описание книги</div>
<div class="book-detail-property">Название: <i>{{ book.name }}</i></div>
<div class="book-detail-property">Название на английском: <i>{{ book.name_eng }}</i></div>
<div class="book-detail-property">Автор: <i>{{ book.autor }}</i></div>
<div class="book-detail-property">Количество страниц: <i>{{ book.pages }}</i></div>
<div class="book-detail-property">Год выпуска: <i>{{ book.pub_year }}</i></div>
<div class="book-detail-description">{{ book.description }}</div>
</div>
</div>
</div>
</div>
</div>
</main>
<footer>
<div class="footer">
<a href="#" class="footer__name">Курсы по питону 2018</a>
<div class="spring"></div>
<a href="mailto:[email protected]" class="footer__mailto">[email protected]</a>
</div>
</footer>
</body>
</html>
{% endblock %}

47 changes: 16 additions & 31 deletions main/templates/main/index.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<title>Книжный магазин</title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
</head>
<body>
<header>
<nav class="nav">
<a href="#" class="nav__bar fa fa-solid bar"></a>
<a href="/" class="nav__logo">Книжный магазин</a>
<div class="spring"></div>
<a href="#" class="nav__basket fa fa-solid basket"></a>
</nav>
</header>
<main>
{% extends 'base.html' %}
{% load static %}

{% block content %}
<div>
<div class="main">
<div class="main__book">
{% for book in books %}
<div class="book-preview">
<img class="book-preview__img" src="/static/books/lutz.png" alt="Название книги">
<div class="book-preview__name">Название</div>
<img class="book-preview__img" src= {% static book.cover %} alt="Название книги">
<div class="book-preview__name">{{ book.name }}</div>
<div class="spring"></div>
<div class="book-preview__author">Автор</div>
<div class="book-preview__author">{{ book.autor }}</div>
<a href="/">Подробнее</a>
<div class="spring"></div>
<div class="book-preview-order">
<div class="book-preview-order__order button">Заказать</div>
<div class="book-preview-order__order button button--disable">Нет в наличии</div>
{% if book.is_available == True %}
<div class="book-preview-order__order button">Заказать</div>
{% else %}
<div class="book-preview-order__order button button--disable">Нет в наличии</div>
{% endif %}
</div>
<p>
</div>
{% endfor %}
</div>
</div>
</div>
</main>
<footer>
<div class="footer">
<a href="#" class="footer__name">Курсы по питону 2018</a>
<div class="spring"></div>
<a href="mailto:[email protected]" class="footer__mailto">[email protected]</a>
</div>
</footer>
</body>
</html>
{% endblock %}
4 changes: 3 additions & 1 deletion market/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [
os.path.join(BASE_DIR, 'templates')
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
Expand Down
32 changes: 32 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Книжный магазин</title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="/static/css/fonts.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/style.css"/>
</head>
<body>
<header>
<nav class="nav">
<a href="#" class="nav__bar fa fa-solid bar"></a>
<a href="/" class="nav__logo">Книжный магазин</a>
<div class="spring"></div>
<a href="#" class="nav__basket fa fa-solid basket"></a>
</nav>
</header>
<main>
{% block content %}
Базовый шаблон
{% endblock %}
</main>
<footer>
<div class="footer">
<a href="#" class="footer__name">Курсы по питону 2018</a>
<div class="spring"></div>
<a href="mailto:[email protected]" class="footer__mailto">[email protected]</a>
</div>
</footer>
</body>
</html>