Add support for editing posts

This commit is contained in:
Trever Fischer
2012-08-29 22:18:41 -04:00
parent e962307adc
commit eed9a6df1b
5 changed files with 41 additions and 2 deletions

View File

@@ -15,5 +15,8 @@ Edited {{post.updated}}
<br style="clear:both"/>
<a href="{% url forums.views.post id=post.id%}">permalink</a>
<a href="{%url forums.views.reply post.id%}">Reply &raquo;</a>
{% if post.user == user or perms.forums.edit_posts %}
<a href="{%url forums.views.editPost post.id%}">Edit &raquo;</a>
{% endif %}
</div>
</div>

View File

@@ -0,0 +1,10 @@
{% extends "forums/reply.html" %}
{% block form %}
{{post}}
<form method="POST" action="{% url forums.views.editPost postID=post.pk %}">
{% csrf_token %}
{{form.as_p}}
<input type="submit" value="Submit"/>
</form>
{% endblock %}

View File

@@ -19,16 +19,20 @@ $(function() {
{% endblock %}
{%block content%}
{% if parent %}
<div class="item">
<h2>Replying to:</h2>
{% include 'forums/_reply.html' with post=post %}
{% include 'forums/_reply.html' with post=parent%}
</div>
{% endif %}
<div class="item">
{% block form %}
<form method="POST" action="{%url forums.views.reply post.id %}">
{% csrf_token %}
{{form.as_p}}
<input type="submit" value="Submit"/>
</form>
{% endblock %}
</div>
<div class="item" id="forum-preview">
</div>