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