1
0
mirror of https://gitlab.com/brutaldon/brutaldon.git synced 2024-11-02 16:37:19 -04:00

Merge branch 'master' of github.com:jfmcbrayer/brutaldon

This commit is contained in:
Jason McBrayer 2018-06-06 15:23:19 -04:00
commit 5bdd29f12e
2 changed files with 20 additions and 0 deletions

View File

@ -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),
]

View File

@ -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)})