mirror of
https://github.com/Xevion/runnerspace.git
synced 2025-12-17 22:13:07 -06:00
Revamp all model relationships to use backref attributes properly
- Fix new post form not including a CSRF token - Removed some old leftover comment profanity validation, changed to validate_on_submit() for first time - Include rest of pluralize macro work with this commit + used pluralizing logic where there once was none
This commit is contained in:
@@ -4,33 +4,25 @@
|
||||
{{ post.text }}
|
||||
<br>
|
||||
<div class="post-author">
|
||||
<em>Posted by <a href="{{ url_for('main.view_user', username=author.username) }}">{{ author.name }}</a></em> <span
|
||||
<em>Posted by <a href="{{ url_for('main.view_user', username=post.author.username) }}">{{ post.author.name }}</a></em> <span
|
||||
title="{{ post.date_posted }}">{{ post.get_time_ago() }} ago</span>.
|
||||
</div>
|
||||
<div class="post-comments">
|
||||
{% if current_user.is_authenticated %}
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<span class="error-message">
|
||||
{{ messages[0] }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<div class="post-comment add-comment">
|
||||
<form method="POST" action="{{ url_for('forms.add_comment', post_id=post.id) }}">
|
||||
<label>
|
||||
<input type="text" name="comment-text">
|
||||
</label>
|
||||
<button>Add Comment</button>
|
||||
{{ form.csrf_token }}
|
||||
{{ form.text }}
|
||||
<input type=submit value="Add Comment">
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% for comment, author in comments_and_authors %}
|
||||
{% for comment in post.comments %}
|
||||
<div class="post-comment">
|
||||
|
||||
<span class="comment-text">"{{ comment.text }}"</span> — <a class="comment-author"
|
||||
href="{{ url_for('main.view_user', username=author.username) }}">{{ author.name }}</a>
|
||||
<span class="comment-text">"{{ comment.text }}"</span> —
|
||||
<a class="comment-author"
|
||||
href="{{ url_for('main.view_user', username=comment.author) }}">{{ comment.author.name }}
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user