From 5e2b025042f5fa6ba222319cf8feb00e4c5c3fff Mon Sep 17 00:00:00 2001 From: Jason McBrayer Date: Fri, 8 Jun 2018 19:03:02 -0400 Subject: [PATCH] A bit more on search templates --- brutaldon/templates/main/search.html | 35 ++++++++++++++++++++ brutaldon/templates/main/search_results.html | 30 +++++++++++++++++ brutaldon/views.py | 4 +-- 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 brutaldon/templates/main/search.html create mode 100644 brutaldon/templates/main/search_results.html diff --git a/brutaldon/templates/main/search.html b/brutaldon/templates/main/search.html new file mode 100644 index 0000000..a67b4b6 --- /dev/null +++ b/brutaldon/templates/main/search.html @@ -0,0 +1,35 @@ +{% extends "base.html" %} +{% load widget_tweaks %} + +{% block title %}brutaldon – search {% endblock %} + +{% block content %} +

Search

+ +
+
+ You can search for tags, users, or for specific toots by URL. You may + also be able to full-text search for toots you have previously + interacted with. +
+
+ +
+ {% csrf_token %} +
+ +
+ + + + +
+
+ +
+ +
+
+ +{% endblock %} diff --git a/brutaldon/templates/main/search_results.html b/brutaldon/templates/main/search_results.html new file mode 100644 index 0000000..04ce276 --- /dev/null +++ b/brutaldon/templates/main/search_results.html @@ -0,0 +1,30 @@ +{% extends "base.html" %} +{% load humanize %} +{% load taglinks %} + +{% block title %} +Brutaldon - search results +{% endblock %} + +{% comment %} +mastodon.search("") + # Returns the following dictionary + { + 'accounts': # List of account dicts resulting from the query + 'hashtags': # List of hashtag dicts resulting from the query + 'statuses': # List of toot dicts resulting from the query + } + +{% endcomment %} + + +{% block content %} +

Search results

+ +

Users

+ + +

Tags

+ +

Toots

+{% endblock %} diff --git a/brutaldon/views.py b/brutaldon/views.py index 5f641e0..55360bc 100644 --- a/brutaldon/views.py +++ b/brutaldon/views.py @@ -419,7 +419,7 @@ def delete(request, id): def search(request): - return render(request, 'search.html', + return render(request, 'main/search.html', {"fullbrutalism": fullbrutalism_p(request)}) def search_results(request): @@ -431,7 +431,7 @@ def search_results(request): query = '' mastodon = get_mastodon(request) results = mastodon.search(query) - return render(request, 'search_results.html', + return render(request, 'main/search_results.html', {"results": results, "fullbrutalism": fullbrutalism_p(request)})