A bit more on search templates

This commit is contained in:
Jason McBrayer 2018-06-08 19:03:02 -04:00
parent f2c8036bc0
commit 5e2b025042
3 changed files with 67 additions and 2 deletions

View File

@ -0,0 +1,35 @@
{% extends "base.html" %}
{% load widget_tweaks %}
{% block title %}brutaldon search {% endblock %}
{% block content %}
<h1 class="title">Search</h1>
<div class="notification">
<div>
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.
</div>
</div>
<form method="get" action="{% url "search_results" %}">
{% csrf_token %}
<div class="field">
<label class="label">{{ form.instance.label }}</label>
<div class="control has-icons-left">
<input type="search" name="q" id="q" class="input">
<span class="icon is-small is-left">
<i class="fa fa-search"></i>
</span>
</div>
</div>
<div class="field">
<input type="submit" name="search"
value="Search" class="button is-primary" >
</div>
</form>
{% endblock %}

View File

@ -0,0 +1,30 @@
{% extends "base.html" %}
{% load humanize %}
{% load taglinks %}
{% block title %}
Brutaldon - search results
{% endblock %}
{% comment %}
mastodon.search("<query>")
# 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 %}
<h1 class="title">Search results</h1>
<h2 class="subtitle">Users</h2>
<h2 class="subtitle">Tags</h2>
<h2 class="subtitle">Toots</h2>
{% endblock %}

View File

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