-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created Custom template filter markdown
- Loading branch information
Showing
7 changed files
with
82 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,51 @@ | ||
{% extends "blog/base.html" %} | ||
{% load blog_tags %} | ||
|
||
{% block title %}{{ post.title }}{% endblock %} | ||
|
||
{% block content %} | ||
<h1>{{ post.title }}</h1> | ||
<p class="date"> | ||
Published {{ post.publish }} by {{ post.author }} | ||
</p> | ||
{{ post.body|linebreaks }} | ||
<p> | ||
<a href="{% url "blog:post_share" post.id %}"> | ||
Share this post | ||
</a> | ||
</p> | ||
<h2>Similar posts</h2> | ||
{% for post in similar_posts %} | ||
<h1>{{ post.title }}</h1> | ||
<p class="date"> | ||
Published {{ post.publish }} by {{ post.author }} | ||
</p> | ||
{{ post.body|markdown }} | ||
<p> | ||
<a href="{{ post.get_absolute_url }}">{{ post.title }}</a> | ||
<a href="{% url "blog:post_share" post.id %}"> | ||
Share this post | ||
</a> | ||
</p> | ||
{% empty %} | ||
There are no similar posts yet. | ||
{% endfor %} | ||
{% with comments.count as total_comments %} | ||
<h2> | ||
{{ total_comments }} comment{{ total_comments|pluralize }} | ||
</h2> | ||
{% endwith %} | ||
{% for comment in comments %} | ||
<div class="comment"> | ||
<p class="info"> | ||
Comment {{ forloop.counter }} by {{ comment.name }} | ||
{{ comment.created }} | ||
</p> | ||
{{ comment.body|linebreaks }} | ||
</div> | ||
{% empty %} | ||
<p>There are no comments yet.</p> | ||
{% endfor %} | ||
{% if new_comment %} | ||
<h2>Your comment has been added.</h2> | ||
{% else %} | ||
<h2>Add a new comment</h2> | ||
<form method="post"> | ||
{{ comment_form.as_p }} | ||
{% csrf_token %} | ||
<p><input type="submit" value="Add comment"></p> | ||
</form> | ||
{% endif %} | ||
<h2>Similar posts</h2> | ||
{% for post in similar_posts %} | ||
<p> | ||
<a href="{{ post.get_absolute_url }}">{{ post.title }}</a> | ||
</p> | ||
{% empty %} | ||
There are no similar posts yet. | ||
{% endfor %} | ||
{% with comments.count as total_comments %} | ||
<h2> | ||
{{ total_comments }} comment{{ total_comments|pluralize }} | ||
</h2> | ||
{% endwith %} | ||
{% for comment in comments %} | ||
<div class="comment"> | ||
<p class="info"> | ||
Comment {{ forloop.counter }} by {{ comment.name }} | ||
{{ comment.created }} | ||
</p> | ||
{{ comment.body|linebreaks }} | ||
</div> | ||
{% empty %} | ||
<p>There are no comments yet.</p> | ||
{% endfor %} | ||
{% if new_comment %} | ||
<h2>Your comment has been added.</h2> | ||
{% else %} | ||
<h2>Add a new comment</h2> | ||
<form method="post"> | ||
{{ comment_form.as_p }} | ||
{% csrf_token %} | ||
<p><input type="submit" value="Add comment"></p> | ||
</form> | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
{% extends "blog/base.html" %} | ||
{% load blog_tags %} | ||
|
||
{% block title %}My Blog{% endblock %} | ||
|
||
{% block content %} | ||
<h1>My Blog</h1> | ||
{% if tag %} | ||
<h2>Posts tagged with "{{ tag.name }}"</h2> | ||
{% endif %} | ||
{% for post in posts %} | ||
<h2> | ||
<a href="{{ post.get_absolute_url }}"> | ||
{{ post.title }} | ||
</a> | ||
</h2> | ||
<p class="tags"> | ||
Tags: | ||
{% for tag in post.tags.all %} | ||
<a href="{% url "blog:post_list_by_tag" tag.slug %}"> | ||
{{ tag.name }} | ||
</a> | ||
{% if not forloop.last %}, {% endif %} | ||
{% endfor %} | ||
</p> | ||
<p class="date"> | ||
Published {{ post.publish }} by {{ post.author }} | ||
</p> | ||
{{ post.body|truncatewords:30|linebreaks }} | ||
{% endfor %} | ||
{% include "pagination.html" with page=posts %} | ||
<h1>My Blog</h1> | ||
{% if tag %} | ||
<h2>Posts tagged with "{{ tag.name }}"</h2> | ||
{% endif %} | ||
{% for post in posts %} | ||
<h2> | ||
<a href="{{ post.get_absolute_url }}"> | ||
{{ post.title }} | ||
</a> | ||
</h2> | ||
<p class="tags"> | ||
Tags: | ||
{% for tag in post.tags.all %} | ||
<a href="{% url "blog:post_list_by_tag" tag.slug %}"> | ||
{{ tag.name }} | ||
</a> | ||
{% if not forloop.last %}, {% endif %} | ||
{% endfor %} | ||
</p> | ||
<p class="date"> | ||
Published {{ post.publish }} by {{ post.author }} | ||
</p> | ||
{{ post.body|markdown|truncatewords:30 }} | ||
{% endfor %} | ||
{% include "pagination.html" with page=posts %} | ||
{% endblock %} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.