parent
40fd0aaa5c
commit
9306248902
|
@ -52,6 +52,9 @@ button, input[type="button"], input[type="submit"], .button {
|
|||
outline: none;
|
||||
font-size: 13px;
|
||||
}
|
||||
form input[type="submit"] {
|
||||
font-size: 15px;
|
||||
}
|
||||
button:hover, button:focus,
|
||||
input[type="button"]:hover, input[type="button"]:focus,
|
||||
input[type="submit"]:hover, input[type="submit"]:focus,
|
||||
|
@ -61,8 +64,8 @@ input[type="submit"]:hover, input[type="submit"]:focus,
|
|||
}
|
||||
|
||||
/* Textbox/textarea styles */
|
||||
textarea, input[type="text"], input[type="password"] {
|
||||
padding: 0 5px;
|
||||
textarea, input[type="text"], input[type="search"], input[type="password"] {
|
||||
padding: 0 2px;
|
||||
outline: none;
|
||||
resize: none;
|
||||
background: none;
|
||||
|
@ -73,13 +76,20 @@ textarea, input[type="text"], input[type="password"] {
|
|||
border-bottom: 1px solid var(--accent-color);
|
||||
border-radius: 0;
|
||||
overflow-x: hidden;
|
||||
display: block;
|
||||
display: inline-block;
|
||||
line-height: 1.5;
|
||||
}
|
||||
textarea::placeholder, input[type="text"]::placeholder {
|
||||
color: var(--text-color);
|
||||
opacity: 50%;
|
||||
}
|
||||
textarea {
|
||||
display: block;
|
||||
}
|
||||
|
||||
form {
|
||||
margin-bottom: 4em;
|
||||
}
|
||||
|
||||
.text, .thought-end {
|
||||
max-width: 100%;
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
</div>
|
||||
|
||||
<input type="submit" id="post-button" value="{% if editing %}Update{% else %}Submit{% endif %}">
|
||||
{{ form.submit }}
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -10,22 +10,15 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<form method="get" action="search">
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>
|
||||
<input type="submit" value="Search">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<form method="get" action="search">
|
||||
{{ form.q }}
|
||||
|
||||
<input type="submit" id="post-button" value="{% if editing %}Update{% else %}Submit{% endif %}">
|
||||
</form>
|
||||
|
||||
{% if query %}
|
||||
{% load tz %}
|
||||
|
||||
<h3>Results</h3>
|
||||
|
||||
{% for thought in page.object_list %}
|
||||
<div class="thought" id="{{ thought.uuid }}">
|
||||
<div class="main">
|
||||
|
@ -51,16 +44,5 @@
|
|||
{% empty %}
|
||||
<p>No results found.</p>
|
||||
{% endfor %}
|
||||
|
||||
<!-- {% if page.has_previous or page.has_next %}
|
||||
<div>
|
||||
{% if page.has_previous %}<a href="?q={{ query }}&page={{ page.previous_page_number }}">{% endif %}« Previous{% if page.has_previous %}</a>{% endif %}
|
||||
|
|
||||
{% if page.has_next %}<a href="?q={{ query }}&page={{ page.next_page_number }}">{% endif %}Next »{% if page.has_next %}</a>{% endif %}
|
||||
</div>
|
||||
{% endif %} -->
|
||||
{% else %}
|
||||
{# Show some example queries to run, maybe query syntax, something else? #}
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,18 +5,18 @@ import base64
|
|||
|
||||
import magic
|
||||
|
||||
from django import forms
|
||||
from django.shortcuts import render, redirect
|
||||
from django.utils.crypto import constant_time_compare
|
||||
|
||||
from whispermaphone import settings
|
||||
from .models import Thought, ThoughtForm, ALLOWED_MEDIA_TYPES
|
||||
|
||||
from .pagination import get_all_pages, get_page_slug
|
||||
|
||||
from haystack.views import SearchView, search_view_factory
|
||||
from haystack.query import SearchQuerySet
|
||||
from haystack.forms import SearchForm
|
||||
|
||||
from whispermaphone import settings
|
||||
from .models import Thought, ThoughtForm, ALLOWED_MEDIA_TYPES
|
||||
from .pagination import get_all_pages, get_page_slug
|
||||
|
||||
def check_authenticated(request):
|
||||
authenticated = False
|
||||
try:
|
||||
|
@ -175,9 +175,18 @@ def about(request):
|
|||
"authenticated": check_authenticated(request)
|
||||
})
|
||||
|
||||
class ThoughtsSearchForm(SearchForm):
|
||||
q = forms.CharField(
|
||||
required=False,
|
||||
widget=forms.TextInput(attrs={"type": "search", "placeholder": "Search query"}),
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
search = search_view_factory(
|
||||
template="thoughts/search/search.html",
|
||||
view_class=SearchView,
|
||||
form_class=SearchForm,
|
||||
form_class=ThoughtsSearchForm,
|
||||
searchqueryset=SearchQuerySet().order_by("-posted")
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue