mirror of
http://git.carcosa.net/jmcbray/brutaldon.git
synced 2024-11-23 15:23:52 -05:00
Views and routes for search
This commit is contained in:
parent
e05601db22
commit
d2de96fceb
@ -45,5 +45,7 @@ urlpatterns = [
|
||||
path('fav/<int:id>', views.fav, name='fav'),
|
||||
path('boost/<int:id>', views.boost, name='boost'),
|
||||
path('delete/<int:id>', views.delete, name='delete'),
|
||||
path('search', views.search, name='search'),
|
||||
path('search_results', views.search_results, name='search_results'),
|
||||
path('', views.home),
|
||||
]
|
||||
|
@ -418,6 +418,24 @@ def delete(request, id):
|
||||
{"toot": toot, 'confirm_page': True,
|
||||
"fullbrutalism": fullbrutalism_p(request)})
|
||||
|
||||
|
||||
def search(request):
|
||||
return render(request, 'search.html',
|
||||
{"fullbrutalism": fullbrutalism_p(request)})
|
||||
|
||||
def search_results(request):
|
||||
if request.method == 'GET':
|
||||
query = request.GET.get('q', '')
|
||||
elif request.method == 'POST':
|
||||
query = request.POST.get('q', '')
|
||||
else:
|
||||
query = ''
|
||||
mastodon = get_mastodon(request)
|
||||
results = mastodon.search(query)
|
||||
return render(request, 'search_results.html',
|
||||
{"results": results,
|
||||
"fullbrutalism": fullbrutalism_p(request)})
|
||||
|
||||
def about(request):
|
||||
return render(request, 'about.html',
|
||||
{"fullbrutalism": fullbrutalism_p(request)})
|
||||
|
Loading…
Reference in New Issue
Block a user