Commit 112bba7b by benjaoming

cleanup

parent 88030a10
from haystack import indexes
from wiki import models
class ArticleIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
created = indexes.DateTimeField(model_attr='created')
modified = indexes.DateTimeField(model_attr='modified')
#default because indexing fails with whoosh. see.
#http://stackoverflow.com/questions/11995367/how-do-i-use-a-boolean-field-in-django-haystack-search-query
#https://github.com/toastdriven/django-haystack/issues/382
other_read = indexes.BooleanField(model_attr='other_read',default=False)
def get_model(self):
return models.Article
def index_queryset(self, using=None):
"""Used when the entire index for model is updated."""
return self.get_model().objects.all()
{{ object.current_revision.title }}
{{ object.current_revision.content }}
{% extends "wiki/base.html" %}
{% load wiki_tags i18n humanize highlight %}
{% load url from future %}
{% block pagetitle %}{% trans "Search results for:" %} {{ search_query }}{% endblock %}
{% block wiki_contents %}
<h1 class="page-header">{% trans "Search results for:" %} {{ search_query }}</h1>
<form class="form-search directory-toolbar">
<p class="lead">
<div class="pull-right">
{{ query }}
<button class="btn"><span class="icon-search"></span></button>
</div>
<p>{% blocktrans with page.paginator.count as cnt %}Your search returned <strong>{{ cnt }}</strong> results.{% endblocktrans %}</p>
<div class="clearfix"></div>
</p>
</form>
<table class="table table-striped">
<tr>
<th style="width: 75%">{% trans "Title" %}</th>
<th>{% trans "Last modified" %}</th>
</tr>
{% with articles=page.object_list %}
{% for article in articles %}
{% with article=article.object %}
<tr>
<td>
{% for urlpath in article.urlpath_set.all %}
<a href="{% url 'wiki:get' path=urlpath.path %}">{{ article.current_revision.title }}<br /><small class="muted">/{{ urlpath.path }}</small></a>
{% empty %}
<a href="{% url 'wiki:get' article_id=article.id %}">{{ article.current_revision.title }}</a>
{% endfor %}
{% if article.current_revision.deleted %}
<span class="icon-trash"></span>
{% endif %}
{% if article.current_revision.locked %}
<span class="icon-lock"></span>
{% endif %}
<p class="muted"><small>{% if article.current_revision %}{% highlight article.current_revision.content with query html_tag "strong" max_length 400 %}{% endif %}</small></p>
</td>
<td style="white-space: nowrap">
{{ article.current_revision.created|naturaltime }}
</td>
</tr>
{% endwith %}
{% empty%}
<tr>
<td colspan="100">
<em>{% trans "There are no articles in this level" %}</em>
</td>
</tr>
{% endfor %}
{% endwith %}
</table>
{% include "wiki/includes/pagination.html" %}
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment