mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 03:43:42 -08:00
community search
This commit is contained in:
parent
2f3f8b6155
commit
d4ea6aba0e
2 changed files with 6 additions and 3 deletions
|
@ -155,15 +155,15 @@ def list_communities():
|
||||||
topic_id = int(request.args.get('topic_id', 0))
|
topic_id = int(request.args.get('topic_id', 0))
|
||||||
sort_by = text('community.' + request.args.get('sort_by') if request.args.get('sort_by') else 'community.post_reply_count desc')
|
sort_by = text('community.' + request.args.get('sort_by') if request.args.get('sort_by') else 'community.post_reply_count desc')
|
||||||
topics = Topic.query.order_by(Topic.name).all()
|
topics = Topic.query.order_by(Topic.name).all()
|
||||||
|
communities = Community.query.filter_by(banned=False)
|
||||||
if search_param == '':
|
if search_param == '':
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
flash('Sorry, no search function yet. Use the topic filter for now.', 'warning')
|
communities = communities.filter(or_(Community.title.ilike(f"%{search_param}%"), Community.ap_id.ilike(f"%{search_param}%")))
|
||||||
# communities = Community.query.filter_by(banned=False)
|
|
||||||
#query = search(select(Community), search_param, sort=True) # todo: exclude banned communities from search
|
#query = search(select(Community), search_param, sort=True) # todo: exclude banned communities from search
|
||||||
#communities = db.session.scalars(query).all()
|
#communities = db.session.scalars(query).all()
|
||||||
|
|
||||||
communities = Community.query.filter_by(banned=False)
|
|
||||||
if topic_id != 0:
|
if topic_id != 0:
|
||||||
communities = communities.filter_by(topic_id=topic_id)
|
communities = communities.filter_by(topic_id=topic_id)
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
</form>
|
</form>
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<span class="mt-1 pl-4">
|
||||||
|
<form method="get"><input type="search" name="search" placeholder="{{ _('Search') }}" value="{{ search }}"></form>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue