beautifed code and added descriptive comments

This commit is contained in:
Esther Kleinhenz
2018-12-09 19:22:30 +01:00
parent db60f32c07
commit faaa66aa8e
16 changed files with 112 additions and 74 deletions
+1 -1
View File
@@ -112,6 +112,7 @@
</div>
</nav>
<!-- Content -->
<div class="content container">
<div class="row">
<div class="col-md-12">
@@ -125,5 +126,4 @@
<script src="{% static 'js/app.js' %}"></script>
<script src="{% static 'bootstrap/js/bootstrap.bundle.js' %}"></script>
</body>
</html>
+11
View File
@@ -1,6 +1,12 @@
<!--
marked parts of the template is external code
import from https://tutorial.djangogirls.org/en/template_extending/
-->
{% extends 'base.html' %}{% block content %}
{% load hitcount_tags %}
<div class="col-md-8">
<!-- imported start -->
<div class="post">
{% if post.published_date %}
<div class="date">
@@ -8,7 +14,11 @@
</div>
{% else %}
<a class="btn btn-outline-dark" href="{% url 'post_publish' pk=post.pk %}">Publish</a>
<!-- imported end -->
{% endif %} {% if user.is_staff and user == post.author %}
<!-- imported start -->
<a class="btn btn-outline-dark" href="{% url 'post_edit' pk=post.pk %}">
<span class="glyphicon glyphicon-pencil">Bearbeiten</span>
</a>
@@ -18,6 +28,7 @@
{% endif %}
<h1>{{ post.title }}</h1>
<p>{{ post.text|linebreaksbr }}</p>
<!-- imported end -->
<p>
Tags:
{% for tag in post.tags.all %}
+4 -1
View File
@@ -1,5 +1,8 @@
<!--
external code
import from https://tutorial.djangogirls.org/en/template_extending/
-->
{% extends 'base.html' %}
{% block content %}
<div class="row">
<div class="col-md-8">
+4 -1
View File
@@ -1,5 +1,8 @@
<!--
external code
import from https://tutorial.djangogirls.org/en/template_extending/
-->
{% extends 'base.html' %}
{% block content %}
<div class="row">
<div class="mx-auto">
+12 -3
View File
@@ -1,24 +1,31 @@
<!--
marked parts of the template is external code
import from https://tutorial.djangogirls.org/en/template_extending/
-->
{% extends 'base.html' %} {% block content %}
<div class="row">
{% if tag %} <div class="mx-auto">
<h2> Artikel mit dem Tag "{{ tag.name }}" </h2>
</div>{% endif %}
</div>
<!-- imported start -->
<div class="row">
<div class="mx-auto">
<h1> Artikleübersicht </h1>
</div>
</div>
</div>
<!-- imported end -->
<div class="row">
<div class="col-md-8">
{% if messages %}
{% if messages %}
<div class="messages">
{% for message in messages %}
<p {% if message.tags %} class="{{ message.tags }}" {% endif %}>{{ message }}</p>
{% endfor %}
</div>
<!-- imported start -->
{% endif %}
{% for post in posts %}
<div class="mt-5 post">
@@ -29,6 +36,8 @@
<a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a>
</h2>
<p>{{ post.text|linebreaks }}</p>
<!-- imported end -->
Tags: {% for tag in post.tags.all %}
<a href="{% url 'post_list_by_tag' tag.slug %}">{{ tag.name }}</a>
{% if not forloop.last %}, {% endif %} {% endfor %} <p>
+9 -5
View File
@@ -1,8 +1,14 @@
<!--
marked parts of the template is external code
import from https://github.com/fizista/django-taggit-templatetags2
-->
{% extends "base.html" %} {% block content %}
<!-- imported start -->
{% load taggit_templatetags2_tags %}
<div class="container">
<div class="row equal">
<div class="col-md-6" >
<div class="col-md-6">
<h1> Alle Tags im Überblick<br>
</h1>
<div class="col-md-8" style="zoom: 1.6">
@@ -11,6 +17,8 @@
{% include_tagcloud 'application.Post' %}
</div>
</div>
<!-- imported end -->
<div style="padding-bottom:40px;">
</div>
Tag-Suche
@@ -43,7 +51,6 @@
{% endfor %}
</div>
</div>
</div>
<div class="col-md-6">
<h1> Bereits abonnierten Tags
@@ -54,14 +61,12 @@
{% for tag in tagsuser %}
<a class="text-white bg-dark p-3" href="{% url 'post_list_by_tag' tag.slug %}">{{ tag.name }}</a>
{% endfor %}
</div>
{% endif %}
</div>
<div style="padding-bottom:145px;">
</div>
<div class="mx-auto">
<div>
Abonniere deine Tags hier!
</div>
@@ -69,7 +74,6 @@
{% csrf_token %} {{form.as_p}}
<button type="submit" class="save btn btn-outline-dark">Sichern</button>
</form>
{% if messages %}
{% for message in messages %}
<div {% if message.tags %} class="{{ message.tags }}" {% endif %}>{{ message }}</div>
+8 -1
View File
@@ -1,3 +1,7 @@
<!--
marked parts of the template is external code
import from https://tutorial.djangogirls.org/en/template_extending/
-->
{% extends "base.html" %} {% block content %}
{% load taggit_templatetags2_tags %}
<div class="row">
@@ -10,6 +14,8 @@
<div class="row">
<div class="col-md-8">
<div>
<!-- imported start -->
{% for post in posts %}
<div class="mt-5 post">
<div class="date">
@@ -18,6 +24,8 @@
<h2>
<a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a>
</h2>
<!-- imported end -->
<p>{{ post.text|linebreaks }}</p>
Tags: {% for tag in post.tags.all %}
<a href="{% url 'post_list_by_tag' tag.slug %}">{{ tag.name }}</a>
@@ -34,6 +42,5 @@
</a>
</div>
</div>
</div>
{% endblock %}
-20
View File
@@ -1,20 +0,0 @@
{% extends 'base.html' %} {% block content %}
{% if tag %} Posts tagged with "{{ tag.name }}" {% endif %}
{% for post in posts %}
<div class="post">
<div class="date">
{{ post.published_date }}
</div>
<h1>
<a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a>
</h1>
<p>{{ post.text|linebreaks }}</p>
Tags: {% for tag in post.tags.all %}
<a href="{% url 'student_page_remove' tag.slug %}">{{ tag.name }}</a>
{% if not forloop.last %}, {% endif %} {% endfor %} <p>
{{ post.author }}
</p>
</div>
{% endfor %}
</div>
{% endblock %}