visual refinements; changed search to use istartswith
svn: r13549
This commit is contained in:
parent
f90c2db4cd
commit
d90fb534e3
@ -48,7 +48,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
{% block footer %}(c) 2009 <a href="http://www.gramps-project.org/">www.gramps-project.net</a>
|
||||
{% block footer %}
|
||||
<p id="createdate">
|
||||
GRAMPS Connect
|
||||
</p>
|
||||
<p id="copyright">© 2009 <a href="http://www.gramps-project.org/">www.gramps-project.net</a>
|
||||
</p>
|
||||
{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
|
@ -1,10 +1,12 @@
|
||||
{% extends "gramps-base.html" %}
|
||||
|
||||
{% block title %}GRAMPS Connect - main page {% endblock %}
|
||||
{% block heading %}GRAMPS - main page {% endblock %}
|
||||
{% block heading %}GRAMPS Connect - main page {% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p id="description">Welcome to GRAMPS Connect, a new web-based collaboration tool.
|
||||
|
||||
{% if user.is_authenticated %}
|
||||
|
@ -17,9 +17,9 @@
|
||||
{% for family in page.object_list %}
|
||||
<tr class="{% cycle odd,even %}">
|
||||
<td>{{ forloop.counter|row_count:page }}</td>
|
||||
<td><a href="/{{view}}/{{family.gramps_id|escape}}" class="noThumb"><span class="grampsid">[{{family.gramps_id}}]</span></a>
|
||||
<td><a href="/{{view}}/{{family.handle|escape}}">{{family.father.name_set|make_name:user}}</a>
|
||||
<td><a href="/{{view}}/{{family.handle|escape}}">{{family.mother.name_set|make_name:user}}</a>
|
||||
<td><a href="/{{view}}/{{family.handle|escape}}" class="noThumb"><span class="grampsid">[{{family.gramps_id}}]</span></a>
|
||||
<td><a href="/person/{{family.father.handle|escape}}">{{family.father.name_set|make_name:user}}</a>
|
||||
<td><a href="/person/{{family.mother.handle|escape}}">{{family.mother.name_set|make_name:user}}</a>
|
||||
{% if user.is_authenticated %}
|
||||
<td><a href="/{{view}}/{{family.handle|escape}}">{{family.family_rel_type|escape}}</a>
|
||||
{% else %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
{% load my_tags %}
|
||||
|
||||
{% block title %}GRAMPS Connect - {{cview}} view page {% endblock %}
|
||||
{% block heading %}GRAMPS - {{cview}} view page {% endblock %}
|
||||
{% block heading %}GRAMPS Connect - {{cview}} view page {% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
@ -71,25 +71,29 @@ def view(request, view):
|
||||
if request.user.is_authenticated():
|
||||
if "," in search:
|
||||
surname, first_name = [term.strip() for term in search.split(",", 1)]
|
||||
object_list = Name.objects. \
|
||||
select_related().filter(surname__icontains=surname,
|
||||
first_name__icontains=first_name).order_by("surname", "first_name")
|
||||
object_list = Name.objects \
|
||||
.filter(surname__istartswith=surname,
|
||||
first_name__istartswith=first_name) \
|
||||
.select_related() \
|
||||
.order_by("surname", "first_name")
|
||||
else:
|
||||
object_list = Name.objects. \
|
||||
select_related().filter(Q(surname__icontains=search) |
|
||||
object_list = Name.objects \
|
||||
.filter(Q(surname__icontains=search) |
|
||||
Q(first_name__icontains=search) |
|
||||
Q(suffix__icontains=search) |
|
||||
Q(prefix__icontains=search) |
|
||||
Q(patronymic__icontains=search) |
|
||||
Q(title__icontains=search) |
|
||||
Q(person__gramps_id__icontains=search)
|
||||
).order_by("surname", "first_name")
|
||||
) \
|
||||
.select_related() \
|
||||
.order_by("surname", "first_name")
|
||||
else:
|
||||
# FIXME: non-authenticated users don't get to search first_names
|
||||
if "," in search:
|
||||
search, first_name = [term.strip() for term in search.split(",", 1)]
|
||||
object_list = Name.objects. \
|
||||
select_related().filter(surname__icontains=search).order_by("surname", "first_name")
|
||||
select_related().filter(surname__istartswith=search).order_by("surname", "first_name")
|
||||
else:
|
||||
object_list = Name.objects.select_related().order_by("surname", "first_name")
|
||||
view_template = 'view_person.html'
|
||||
|
Loading…
Reference in New Issue
Block a user