{% extends "base.html" %}
{% block title %}Bloggato{% endblock %}

{% block content %}
<br>
<br>

{% if post %}
    <h1>{{ post.title }}</h1>
    <ul>
        <div class="body">{{ post.text|linebreaks }}</div>
        <p><span class="glyphicon glyphicon-time"></span> Posted on {{ post.date }}</p>
    </ul>
{% endif %}

<!-- Comment form -->
<div class="well">
    <h4>Leave a Comment:</h4>
    <form role="form" action="{% url 'blog.views.add_comment' post.id %}" method="POST">
        {% csrf_token %}
        <div class="form-group">
            <textarea class="form-control" rows="3" id="id_text" name="text"></textarea>
        </div>
        <button type="submit" class="btn btn-primary">Submit</button>
    </form>
</div>

<!-- Comments  -->
{% if comments %} 
    {% for comment in comments %}
        <h3>{{ comment.user }} - <small><span class="glyphicon glyphicon-time"></span> {{ comment.date }}</small></h3>
        <p>{{ comment.text }}</p>
    {% endfor %}
{% endif %}

{% endblock %}
{% extends "base.html" %}
{% block title %}Bloggato{% endblock %}

{% block content %}
<br>
<br>

{% if post %}
    <h1>{{ post.title }}</h1>
    <ul>
        <div class="body">{{ post.text|linebreaks }}</div>
        <p><span class="glyphicon glyphicon-time"></span> Posted on {{ post.date }}</p>
        {% if user.is_authenticated %}
            <p>
                <a href="/blog/{{ post.id }}/edit">
                    <button type="button" class="btn btn-primary btn-xs">Edit</button>
                </a>
                <a href="/blog/{{ post.id }}/delete">
                    <button type="button" class="btn btn-primary btn-xs">Delete</button>
                </a>
            </p>
        {% endif %}
    </ul>
{% endif %}

<!-- Comment form -->
<div class="well">
    <h4>Leave a Comment:</h4>
    <form role="form" action="{% url 'blog.views.add_comment' post.id %}" method="POST">
        {% csrf_token %}
        <div class="form-group">
            <textarea class="form-control" rows="3" id="id_text" name="text"></textarea>
        </div>
        <button type="submit" class="btn btn-primary">Submit</button>
    </form>
</div>

<!-- Comments  -->
{% if comments %} 
    {% for comment in comments %}
        <h3>{{ comment.user }} - <small><span class="glyphicon glyphicon-time"></span> {{ comment.date }}</small></h3>
        <p>{{ comment.text }}</p>
    {% endfor %}
{% endif %}

{% endblock %}
Add Edit and Delete buttons to BlogPost page
Add Edit and Delete buttons to BlogPost page
