Revamp all form submissions with Flask-WTF forms

- Rename blueprint route 'main.user' to 'main.view_user' for clarity
- Rename 'forms.py' to 'route_forms.py'
This commit is contained in:
Xevion
2022-03-29 02:00:43 -05:00
parent 4968868d3a
commit 2e8688f59b
8 changed files with 36 additions and 28 deletions

View File

@@ -7,7 +7,7 @@
<div class="header-login">
{% if current_user.is_authenticated %}
Logged in as
<a href="{{ url_for('main.user', username=current_user.username) }}" class="username">{{ current_user.username }}</a>
<a href="{{ url_for('main.view_user', username=current_user.username) }}" class="username">{{ current_user.username }}</a>
<a href="{{ url_for('main.edit_user', username=current_user.username) }}"><i class="fas fa-cog fa-1x"></i></a>
| <a href="{{ url_for('auth.logout') }}">Logout</a>
{% else %}

View File

@@ -7,7 +7,7 @@
<div>
<ul>
{% for new_user in new_users %}
<li><a href="{{ url_for('main.user', username=new_user.username) }}">{{ new_user.username }}</a> as
<li><a href="{{ url_for('main.view_user', username=new_user.username) }}">{{ new_user.username }}</a> as
of {{ new_user.get_registration_delta() }} ago
</li>
{% endfor %}

View File

@@ -13,21 +13,27 @@
<div class="field">
<div class="control">
Username
<input class="input is-large" type="text" name="username" placeholder="Username" autofocus>
<input class="input" type="text" name="username" placeholder="Username" autofocus>
</div>
</div>
<div class="field">
<div class="control">
Name
<input class="input is-large" type="text" name="name" placeholder="Name" autofocus>
<input class="input" type="text" name="name" placeholder="Name" autofocus>
</div>
</div>
<div class="field">
<div class="control">
Password
<input class="input is-large" type="password" name="password" placeholder="Password">
<input class="input" type="password" name="password" placeholder="Password">
</div>
</div>
<div class="field">
<div class="control">
Confirm Password
<input class="input" type="password" name="confirm" placeholder="Confirm Password">
</div>
</div>
<button>Sign Up</button>

View File

@@ -9,7 +9,7 @@
<div class="user-box-top">
<span class="user-box-username">
<a href="{{ url_for('main.user', username=user.username) }}">{{ user.name }}</a>
<a href="{{ url_for('main.view_user', username=user.username) }}">{{ user.name }}</a>
</span>
{% with seen_text = user.get_last_seen() %}
{% if seen_text == 'Online now!' %}

View File

@@ -22,7 +22,7 @@
<div class="post-box">
{{ post.text }}
<div class="post-author no-border">
<em>Posted by <a href="{{ url_for('main.user', username=author.username) }}">{{ author.name }}</a></em> <span
<em>Posted by <a href="{{ url_for('main.view_user', username=author.username) }}">{{ author.name }}</a></em> <span
title="{{ post.date_posted }}">{{ post.get_time_ago() }} ago</span>. |
<a href="{{ url_for('main.view_post', post_id=post.id) }}"><span>{{ post.comments|length }} comments</span></a>
</div>

View File

@@ -4,7 +4,7 @@
{{ post.text }}
<br>
<div class="post-author">
<em>Posted by <a href="{{ url_for('main.user', username=author.username) }}">{{ author.name }}</a></em> <span
<em>Posted by <a href="{{ url_for('main.view_user', username=author.username) }}">{{ author.name }}</a></em> <span
title="{{ post.date_posted }}">{{ post.get_time_ago() }} ago</span>.
</div>
<div class="post-comments">
@@ -30,7 +30,7 @@
<div class="post-comment">
<span class="comment-text">"{{ comment.text }}"</span><a class="comment-author"
href="{{ url_for('main.user', username=author.username) }}">{{ author.name }}</a>
href="{{ url_for('main.view_user', username=author.username) }}">{{ author.name }}</a>
</div>
{% endfor %}
</div>