mirror of
https://github.com/evennia/evennia.git
synced 2026-04-01 21:47:17 +02:00
Some cosmetics. Also make searching news match against Title and Body for now. Will eventually have some checkboxes to with the option to do both or only one.
This commit is contained in:
parent
85d13fe16b
commit
65e1b85c6f
2 changed files with 3 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ import django.views.generic.list_detail as gv_list_detail
|
|||
from django.http import HttpResponseRedirect
|
||||
from django.contrib.auth.models import User
|
||||
from django import newforms as forms
|
||||
from django.db.models import Q
|
||||
|
||||
from apps.news.models import NewsTopic, NewsEntry
|
||||
|
||||
|
|
@ -93,7 +94,7 @@ def search_results(request):
|
|||
valid_search = search_form.is_valid()
|
||||
cleaned_get = search_form.cleaned_data
|
||||
|
||||
news_entries = NewsEntry.objects.filter(title__contains=cleaned_get['search_terms'])
|
||||
news_entries = NewsEntry.objects.filter(Q(title__contains=cleaned_get['search_terms']) | Q(body__contains=cleaned_get['search_terms']))
|
||||
|
||||
pagevars = {
|
||||
"page_title": "Search Results",
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@
|
|||
long.</p>
|
||||
<form method="GET">
|
||||
{{search_form.search_terms}}
|
||||
<button type="Submit">Submit</button>
|
||||
<button type="Submit">Search</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue