mirror of
https://git.wownero.com/wownero/YellWOWPages.git
synced 2024-08-15 01:03:25 +00:00
Ignore accounts without address, add user page
This commit is contained in:
parent
cc0c35814f
commit
9a51c3c4fb
4 changed files with 59 additions and 2 deletions
|
@ -13,7 +13,9 @@ async def api_root():
|
|||
|
||||
@bp_api.get('/user/')
|
||||
async def api_all():
|
||||
return jsonify([u.to_json(ignore_key='id') for u in User.select()])
|
||||
q = User.select()
|
||||
q = q.where(User.address.is_null(False))
|
||||
return jsonify([u.to_json(ignore_key='id') for u in q])
|
||||
|
||||
|
||||
@bp_api.get('/user/<path:needle>')
|
||||
|
|
|
@ -70,6 +70,19 @@ async def search():
|
|||
return await render_template('search.html', users=users)
|
||||
|
||||
|
||||
@bp_routes.route("/user/<path:name>")
|
||||
async def user_page(name: str):
|
||||
if not name or len(name) <= 1:
|
||||
raise Exception("invalid name")
|
||||
|
||||
_user = User.select().where(
|
||||
User.username == name,
|
||||
User.address.is_null(False)
|
||||
).get()
|
||||
|
||||
return await render_template('user.html', users=[_user])
|
||||
|
||||
|
||||
@bp_routes.route("/about")
|
||||
async def about():
|
||||
return await render_template('about.html')
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{% for user in users %}
|
||||
<article>
|
||||
<header>
|
||||
<em>{{user.username}}</em>
|
||||
<em><a href="{{ url_for('bp_routes.user_page', name=user.username) }}">{{user.username}}</a></em>
|
||||
<small style="float: right">Added: {{ user.created_dt }}</small>
|
||||
</header>
|
||||
<kbd>{{user.address}}</kbd>
|
||||
|
|
42
yellow/templates/user.html
Normal file
42
yellow/templates/user.html
Normal file
|
@ -0,0 +1,42 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div style="display:none">
|
||||
{% block title %}YellWOWPages - User{% endblock %}
|
||||
</div>
|
||||
|
||||
<div id="main">
|
||||
{% include 'includes/search.html' %}
|
||||
|
||||
{% if not users %}
|
||||
<br>Nothing found...
|
||||
{% else %}
|
||||
{% include 'includes/user_results.html' %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
#main{
|
||||
width: 100%;
|
||||
height: 80vh;
|
||||
display: grid;
|
||||
place-content: center;
|
||||
}
|
||||
form{
|
||||
height: 80px;
|
||||
}
|
||||
#addresses{
|
||||
width: 100%;
|
||||
height: 50vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
#addresses::-webkit-scrollbar{
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 800px) {
|
||||
kbd{
|
||||
width: 100vw;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in a new issue