{% extends "base.html" %}

{% block content %}
{% autoescape off %}

<h1>{{blogentry.header}}</h1>
<small>posted by {{blogentry.user.username}} on {{blogentry.date}}
</small>
<br><br>
{{blogentry.intro|linebreaks}}<br>
{{blogentry.body|linebreaks}}<br><br>
{% endautoescape %}


<b>Comments total: {{blogentry.blogcomment_set.all.count}}</b><br/>

{% if commentform %}
<form action="" method="post">
	{% csrf_token %}
  	Your Name:<br>
  	{{ commentform.guestname }}
	<br/>Your Comment:<br/>
	{{ commentform.blogcomment }}<br>
	<input type="submit" value="Submit" />
</form>
{% endif %}

{% for comment in blogentry.blogcomment_set.all %}
{% if comment.user %}
<h3>{{ comment.user.username }} says:</h3>
{% else %}
<h3>{{ comment.guestname }} says:</h3>
{% endif %}
{{ comment.body|linebreaks }}<br/>
<small>{{ comment.date }}</small>
{% endfor %}
{% if false %}
<table class="forumentry">
<tr>
	<td align="center" style="border-top:1px; width: 80px; solid #b2c9d5;"><img src="/polylux/{{ newscomment.user.get_profile.getImage }}"></img></td>
	<td style="border-top:1px solid #b2c9d5;"><br/><a href="/blackmesa/usermanager/detail/{{newscomment.user.id}}/">{{newscomment.user.username}}</a><br>{{ newscomment.commenttext|linebreaks|urlize }}<br/><small>Datum: {{newscomment.date}}</small></td>
</tr>
</table>


<table
style="text-align: left; width: 75%; margin-left: auto; margin-right: auto;"
border="0" cellpadding="0" cellspacing="0">
<tbody>
{% if commentform %}
<tr>
	<td align="center">{{user.username}}<br><img src="/polylux/{{ user.get_profile.getImage }}"></img></td>
	<td>
		<form action="" method="post">
			{% csrf_token %}
			{{ commentform.newscomment }}<br>
			<input type="submit" value="Submit" />
		</form>
	</td>
</tr>
{% else %}
<tr>
	<td align="center"></td>
	<td>
		<strong>Please log in to post.</strong>
	</td>
</tr>
{% endif %}
</tbody>
</table>
{% endif %}
{% endblock %}


