setting up routes and templates for creators
parent
531522e95f
commit
3a3037b82a
@ -0,0 +1,25 @@
|
|||||||
|
from quart import Blueprint, render_template, flash, redirect
|
||||||
|
|
||||||
|
from xmrbackers.models import User, CreatorProfile
|
||||||
|
|
||||||
|
|
||||||
|
bp = Blueprint('creator', 'creator')
|
||||||
|
|
||||||
|
@bp.route('/creators')
|
||||||
|
async def all():
|
||||||
|
creators = CreatorProfile.select().order_by(
|
||||||
|
CreatorProfile.create_date.desc()
|
||||||
|
)
|
||||||
|
return await render_template('creator/creators.html', creators=creators)
|
||||||
|
|
||||||
|
@bp.route('/creator/<username>')
|
||||||
|
async def show(username):
|
||||||
|
user = User.select().where(User.username == username)
|
||||||
|
creator = CreatorProfile.select().where(
|
||||||
|
CreatorProfile.user == user
|
||||||
|
).first()
|
||||||
|
if creator:
|
||||||
|
return await render_template('creator/creator.html', creator=creator)
|
||||||
|
else:
|
||||||
|
flash('That creator does not exist.')
|
||||||
|
return redirect(url_for('meta.index'))
|
@ -0,0 +1,23 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
{% include 'includes/head.html' %}
|
||||||
|
|
||||||
|
<body class="is-preload landing">
|
||||||
|
<div id="page-wrapper">
|
||||||
|
|
||||||
|
{% include 'includes/header.html' %}
|
||||||
|
|
||||||
|
{% if creator %}
|
||||||
|
<h1>{{ creator.user.username }}</h1>
|
||||||
|
<p>Bio: {{ creator.bio }}</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% include 'includes/footer.html' %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% include 'includes/scripts.html' %}
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,27 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
{% include 'includes/head.html' %}
|
||||||
|
|
||||||
|
<body class="is-preload landing">
|
||||||
|
<div id="page-wrapper">
|
||||||
|
|
||||||
|
{% include 'includes/header.html' %}
|
||||||
|
|
||||||
|
{% if creators %}
|
||||||
|
<h1>All Creators</h1>
|
||||||
|
<ul>
|
||||||
|
{% for c in creators %}
|
||||||
|
<li><a href="{{ url_for('creator.show', username=c.user.username) }}">{{ c.user.username }}</a> - profile created {{ c.create_date | humanize }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% include 'includes/footer.html' %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% include 'includes/scripts.html' %}
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue