Skip to content

Commit

Permalink
Add templates
Browse files Browse the repository at this point in the history
  • Loading branch information
acsany committed Jan 8, 2025
1 parent 012c170 commit cc63dfe
Show file tree
Hide file tree
Showing 20 changed files with 147 additions and 175 deletions.
50 changes: 23 additions & 27 deletions django-diary/source_code_final/entries/templates/entries/base.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>My Diary</title>
<link rel="stylesheet" href="{% static 'css/diary.css' %}">
</head>

<body>
<h1><a href="/">Dear diary …</a></h1>

{% if messages %}
<ul class="messages">
{% for message in messages %}
<li class="message">
{{ message }}
</li>
{% endfor %}
</ul>
{% endif %}

{% block content %}{% endblock %}

<hr>
<a href="{% url 'admin:logout' %}">Logout</a>
</body>

</html>
<head>
<meta charset="UTF-8">
<title>My Diary</title>
<link rel="stylesheet" href="{% static 'css/diary.css' %}">
</head>
<body>
<h1>
<a href="/">Dear diary …</a>
</h1>
{% if messages %}
<ul class="messages">
{% for message in messages %}<li class="message">{{ message }}</li>{% endfor %}
</ul>
{% endif %}
{% block content %}
{% endblock content %}
<hr>
<form method="post" action="{% url 'admin:logout' %}">
{% csrf_token %}
<input type="submit" value="Logout" />
</form>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{% extends "entries/base.html" %}
{% block content %}
<form method="post">{% csrf_token %}
<form method="post">
{% csrf_token %}
<p>
Are you sure you want to delete <em>"{{ entry.title }}"</em><br>
Are you sure you want to delete
<em>"{{ entry.title }}"</em>
created on {{ entry.date_created|date:'Y-m-d' }}?
</p>
<input type="submit" value="Confirm">
</form>
<a href="{% url 'entry-detail' entry.id %}">
<button>Cancel</button>
</a>
{% endblock %}
{% endblock content %}
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{% extends "entries/base.html" %}

{% block content %}
<article>
<h2>{{ entry.date_created|date:'Y-m-d H:i' }}</h2>
<h3>{{ entry.title }}</h3>
<p>{{ entry.content }}</p>
</article>

<p>
<a href="{% url 'entry-update' entry.id %}">✍️ Edit</a>
<a href="{% url 'entry-delete' entry.id %}">⛔ Delete</a>
</p>
{% endblock %}
<p>
<a href="{% url 'entry-update' entry.id %}">✍️ Edit</a>
<a href="{% url 'entry-delete' entry.id %}">⛔ Delete</a>
</p>
{% endblock content %}
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{% extends "entries/base.html" %}
{% block content %}
<form method="post">{% csrf_token %}
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save">
</form>
{% if entry %}
<a href="{% url 'entry-detail' entry.id %}">
<button>Cancel</button>
<button>Cancel</button>
</a>
{% else %}
<a href="{% url 'entry-list' %}">
<button>Cancel</button>
<button>Cancel</button>
</a>
{% endif %}
{% endblock %}
{% endblock content %}
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
{% extends "entries/base.html" %}

{% block content %}
<article>
<h2 class="mark">{% now "Y-m-d H:i" %}</em></h2>
<a href="{% url 'entry-create' %}"><button>Add new entry</button></a>
<h2 class="mark">
{% now "Y-m-d H:i" %}</em>
</h2>
<a href="{% url 'entry-create' %}">
<button>Add new entry</button>
</a>
</article>
{% for entry in entry_list %}
<article>
<h2 class="{{ entry.date_created|date:'l' }}">{{ entry.date_created|date:'Y-m-d H:i' }}</h2>
<h3>
<a href="{% url 'entry-detail' entry.id %}">{{ entry.title }}</a>
</h3>
</article>
{% for entry in entry_list %}
<article>
<h2 class="{{ entry.date_created|date:'l' }}">
{{ entry.date_created|date:'Y-m-d H:i' }}
</h2>
<h3>
<a href="{% url 'entry-detail' entry.id %}">
{{ entry.title }}
</a>
</h3>
</article>
{% endfor %}
{% endblock %}
{% endfor %}
{% endblock content %}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<h2>{{ entry.date_created|date:'Y-m-d H:i' }}</h2>
<h3>{{ entry.title }}</h3>
<p>{{ entry.content }}</p>
</article>
</article>
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{% for entry in entry_list %}
<article>
<h2 class="{{ entry.date_created|date:'l' }}">
{{ entry.date_created|date:'Y-m-d H:i' }}
</h2>
<h2 class="{{ entry.date_created|date:'l' }}">{{ entry.date_created|date:'Y-m-d H:i' }}</h2>
<h3>
<a href="{% url 'entry-detail' entry.id %}">
{{ entry.title }}
</a>
<a href="{% url 'entry-detail' entry.id %}">{{ entry.title }}</a>
</h3>
</article>
{% endfor %}
{% endfor %}
28 changes: 13 additions & 15 deletions django-diary/source_code_step_4/entries/templates/entries/base.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>My Diary</title>
<link rel="stylesheet" href="{% static 'css/diary.css' %}">
</head>

<body>
<h1><a href="/">Dear diary …</a></h1>

{% block content %}{% endblock %}

</body>

</html>
<head>
<meta charset="UTF-8">
<title>My Diary</title>
<link rel="stylesheet" href="{% static 'css/diary.css' %}">
</head>
<body>
<h1>
<a href="/">Dear diary …</a>
</h1>
{% block content %}
{% endblock content %}
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{% extends "entries/base.html" %}

{% block content %}
<article>
<h2>{{ entry.date_created|date:'Y-m-d H:i' }}</h2>
<h3>{{ entry.title }}</h3>
<p>{{ entry.content }}</p>
</article>
{% endblock %}
{% endblock content %}
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
{% extends "entries/base.html" %}

{% block content %}
{% for entry in entry_list %}
<article>
<h2 class="{{ entry.date_created|date:'l' }}">
{{ entry.date_created|date:'Y-m-d H:i' }}
</h2>
<h2 class="{{ entry.date_created|date:'l' }}">{{ entry.date_created|date:'Y-m-d H:i' }}</h2>
<h3>
<a href="{% url 'entry-detail' entry.id %}">
{{ entry.title }}
</a>
<a href="{% url 'entry-detail' entry.id %}">{{ entry.title }}</a>
</h3>
</article>
{% endfor %}
{% endblock %}
{% endblock content %}
26 changes: 12 additions & 14 deletions django-diary/source_code_step_5/entries/templates/entries/base.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>My Diary</title>
<link rel="stylesheet" href="{% static 'css/diary.css' %}">
</head>

<body>
<h1><a href="/">Dear diary …</a></h1>

{% block content %}{% endblock %}

</body>

<head>
<meta charset="UTF-8">
<title>My Diary</title>
<link rel="stylesheet" href="{% static 'css/diary.css' %}">
</head>
<body>
<h1>
<a href="/">Dear diary …</a>
</h1>
{% block content %}
{% endblock content %}
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{% extends "entries/base.html" %}
{% block content %}
<form method="post">{% csrf_token %}
<form method="post">
{% csrf_token %}
<p>
Are you sure you want to delete <em>"{{ entry.title }}"</em><br>
Are you sure you want to delete
<em>"{{ entry.title }}"</em>
created on {{ entry.date_created|date:'Y-m-d' }}?
</p>
<input type="submit" value="Confirm">
</form>
<a href="{% url 'entry-detail' entry.id %}">
<button>Cancel</button>
</a>
{% endblock %}
{% endblock content %}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{% extends "entries/base.html" %}

{% block content %}
<article>
<h2>{{ entry.date_created|date:'Y-m-d H:i' }}</h2>
<h3>{{ entry.title }}</h3>
<p>{{ entry.content }}</p>
</article>
{% endblock %}
{% endblock content %}
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{% extends "entries/base.html" %}
{% block content %}
<form method="post">{% csrf_token %}
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save">
</form>
{% if entry %}
<a href="{% url 'entry-detail' entry.id %}">
<button>Cancel</button>
<button>Cancel</button>
</a>
{% else %}
<a href="{% url 'entry-list' %}">
<button>Cancel</button>
<button>Cancel</button>
</a>
{% endif %}
{% endblock %}
{% endblock content %}
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
{% extends "entries/base.html" %}

{% block content %}
{% for entry in entry_list %}
<article>
<h2 class="{{ entry.date_created|date:'l' }}">
{{ entry.date_created|date:'Y-m-d H:i' }}
</h2>
<h2 class="{{ entry.date_created|date:'l' }}">{{ entry.date_created|date:'Y-m-d H:i' }}</h2>
<h3>
<a href="{% url 'entry-detail' entry.id %}">
{{ entry.title }}
</a>
<a href="{% url 'entry-detail' entry.id %}">{{ entry.title }}</a>
</h3>
</article>
{% endfor %}
{% endblock %}
{% endblock content %}
41 changes: 17 additions & 24 deletions django-diary/source_code_step_6/entries/templates/entries/base.html
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>My Diary</title>
<link rel="stylesheet" href="{% static 'css/diary.css' %}">
</head>

<body>
<h1><a href="/">Dear diary …</a></h1>

{% if messages %}
<ul class="messages">
{% for message in messages %}
<li class="message">
{{ message }}
</li>
{% endfor %}
</ul>
{% endif %}

{% block content %}{% endblock %}

</body>

<head>
<meta charset="UTF-8">
<title>My Diary</title>
<link rel="stylesheet" href="{% static 'css/diary.css' %}">
</head>
<body>
<h1>
<a href="/">Dear diary …</a>
</h1>
{% if messages %}
<ul class="messages">
{% for message in messages %}<li class="message">{{ message }}</li>{% endfor %}
</ul>
{% endif %}
{% block content %}
{% endblock content %}
</body>
</html>
Loading

0 comments on commit cc63dfe

Please sign in to comment.