add a base.html file and refactor the other html files

This commit is contained in:
Andreas Zweili 2017-12-19 20:21:46 +01:00
parent b8fa6eef5c
commit bc3b14b5dd
4 changed files with 43 additions and 47 deletions

View File

@ -1,15 +1,9 @@
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="{{ STATIC_URL }}/static/admin/css/base.css" />
</head>
<body>
<div id="content" class="flex">
<h1>{{ article.name }}</h1>
<h3>Description</h3>
<p>{{ article.description }}</p>
<p><b>Stock:</b> {{ article.stock }}</p>
<p><b>Status:</b> {{ article.status}}</p>
<p><b>Price:</b> {{ article.price_in_chf }}</p>
</div>
</body>
</html>
{% extends "webshop/base.html" %}
{% block section_title %}{{ article.name }}{% endblock %}
{% block content %}
<h3>Description</h3>
<p>{{ article.description }}</p>
<p><b>Stock:</b> {{ article.stock }}</p>
<p><b>Status:</b> {{ article.status}}</p>
<p><b>Price:</b> {{ article.price_in_chf }}</p>
{% endblock %}

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="{{ STATIC_URL }}/static/admin/css/base.css" />
</head>
<body>
<div id="content" class="flex">
<h1>{% block section_title %}Music Instrument Shop{% endblock %}</h1>
{% block content %}{% endblock %}
</div>
</body>
<footer>
{% block footer %}
<p><font size="1">This is a case study project of Ivan Hörler and Andreas Zweili.
It is a school project/excercise and has no commercial intent.</font></p>
{% endblock %}
</footer>
</html>

View File

@ -1,21 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="{{ STATIC_URL }}/static/admin/css/base.css" />
</head>
<body>
<div id="content" class="flex">
<h1>{{ category.name }}</h1>
{% if article_list %}
<ul>
{% for article in article_list %}
<li><a href="{% url 'details' article.id %}">{{ article.name }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>There are no articles in this category.</p>
{% endif %}
</div>
</body>
</html>
{% extends "webshop/base.html" %}
{% block section_title %}Category Overview{% endblock %}
{% block content %}
{% if article_list %}
<ul>
{% for article in article_list %}
<li><a href="{% url 'details' article.id %}">{{ article.name }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>There are no articles in this category.</p>
{% endif %}
{% endblock %}

View File

@ -1,10 +1,5 @@
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="{{ STATIC_URL }}/static/admin/css/base.css" />
</head>
<body>
<div id="content" class="flex">
<h1>Music Shop</h1>
{% extends "webshop/base.html" %}
{% block content %}
{% if category_list %}
<ul>
{% for category, sub_category in category_list.items %}
@ -18,7 +13,5 @@
</ul>
{% else %}
<p>No categories are available.</p>
{% endif %}
</div>
</body>
</html>
{% endif %}
{% endblock %}