DRY comments, stay on details when commenting
This commit is contained in:
parent
23f1b14acb
commit
767a8d630d
@ -29,14 +29,7 @@ Scheduled
|
||||
<a class=roundedButton href="/cfp/edit/{{ proposal.id }}">Edit</A>
|
||||
{% endif %}
|
||||
<a class=roundedButton href="/{{ request.session.lastlist }}">Back</A>
|
||||
<h4>Comments</h4>
|
||||
<hr>
|
||||
{% for comment in comments %}
|
||||
<p>Comment by {{ comment.author }}
|
||||
on {{ comment.posted_date|date:"Y-m-d G:i O" }}:<br>
|
||||
{{ comment.content|linebreaks|urlize }}</p>
|
||||
<br><hr>
|
||||
{% endfor %}
|
||||
{% include "comments.html" %}
|
||||
<form action="/cfp/details/{{ proposal.id }}" method="post">
|
||||
{% endblock %}
|
||||
{% block formfooter %}
|
||||
|
@ -28,12 +28,5 @@ in topic <b>{{ proposal.topic }}</b></p>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
<h4>Comments</h4>
|
||||
<hr>
|
||||
{% for comment in comments %}
|
||||
<p>Comment by {{ comment.author }}
|
||||
on {{ comment.posted_date|date:"Y-m-d G:i O" }}:<br>
|
||||
{{ comment.content|linebreaks|urlize }}</p>
|
||||
<br><hr>
|
||||
{% endfor %}
|
||||
{% include "comments.html" %}
|
||||
{% endblock %}
|
||||
|
@ -98,7 +98,6 @@ def is_editable(proposal, user):
|
||||
@login_required
|
||||
def details(request, proposalid):
|
||||
proposal = Proposal.objects.get(id=proposalid)
|
||||
comments = Comment.objects.filter(proposal=proposal)
|
||||
if request.method == 'POST':
|
||||
form = CommentForm(request.POST)
|
||||
if form.is_valid():
|
||||
@ -106,9 +105,9 @@ def details(request, proposalid):
|
||||
comment.proposal = proposal
|
||||
comment.author = request.user
|
||||
comment.save()
|
||||
return HttpResponseRedirect('/%s' % request.session['lastlist'])
|
||||
else:
|
||||
form = CommentForm()
|
||||
comments = Comment.objects.filter(proposal=proposal)
|
||||
return render(request, "cfpdetails.html",
|
||||
{'proposal': proposal,
|
||||
'form': form,
|
||||
|
Loading…
x
Reference in New Issue
Block a user