Added links as search terms
svn: r19831
This commit is contained in:
parent
1f8f4c6b5c
commit
d4f92a2943
@ -48,21 +48,21 @@
|
||||
<tr><td id="rowspace"></td></tr>
|
||||
<tr>
|
||||
<td class="ColumnAttribute">{{nameform.first_name.label}}:</td>
|
||||
<td class="ColumnValue" id="data" colspan="4">{% render nameform.first_name user action %}</td>
|
||||
<td class="ColumnValue" id="data" colspan="4">{% render nameform.first_name user action None "/person/?search=given%%3D%s" nameform.model.first_name %}</td>
|
||||
<td class="ColumnValue" id="data">{% render nameform.suffix user action %}</td>
|
||||
</tr>
|
||||
<tr><td id="rowspace"></td></tr>
|
||||
<tr>
|
||||
<td class="ColumnAttribute">{{surnameform.surname.label}}:</td>
|
||||
<td class="ColumnValue" id="data">{% render surnameform.prefix user action %}</td>
|
||||
<td class="ColumnValue" id="data" colspan="2">{% render surnameform.surname user action %}</td>
|
||||
<td class="ColumnValue" id="data">{% render surnameform.prefix user action %}
|
||||
<td class="ColumnValue" id="data" colspan="2">{% render surnameform.surname user action None "/person/?search=surname%%3D%s" surnameform.model.surname %}</td>
|
||||
<td class="ColumnAttribute">{{surnameform.name_origin_type.label}}:</td>
|
||||
<td class="ColumnValue" id="data" colspan="2">{% render surnameform.name_origin_type user action %}</td>
|
||||
</tr>
|
||||
<tr><td id="rowspace"></td></tr>
|
||||
<tr>
|
||||
<td class="ColumnAttribute">{{personform.gender_type.label}}:</td>
|
||||
<td class="ColumnValue" id="data">{% render personform.gender_type user action %}</td>
|
||||
<td class="ColumnValue" id="data">{% render personform.gender_type user action None "/person/?search=gender%%3D%s" personform.model.gender_type %}</td>
|
||||
<td class="ColumnAttribute">{{personform.gramps_id.label}}:</td>
|
||||
<td class="ColumnValue" id="data">{% render personform.gramps_id user action %}</td>
|
||||
<td class="ColumnAttribute">{{personform.tags.label}}:</td>
|
||||
|
@ -166,6 +166,13 @@ class EventType(mGrampsType):
|
||||
DEATH = 13
|
||||
val = models.IntegerField('event type', choices=_DATAMAP, blank=False)
|
||||
|
||||
def get_url(self):
|
||||
return "/event/?search=type%%3D%s" % self.name
|
||||
|
||||
def get_link(self):
|
||||
return "<a href='%s'>%s</a>" % (self.get_url(), self.name)
|
||||
|
||||
|
||||
class FamilyRelType(mGrampsType):
|
||||
from gen.lib.familyreltype import FamilyRelType
|
||||
_DATAMAP = get_datamap(FamilyRelType)
|
||||
|
@ -98,6 +98,7 @@ def context_processor(request):
|
||||
context["gramps_version"] = const.VERSION
|
||||
context["views"] = VIEWS
|
||||
context["menu"] = MENU
|
||||
context["None"] = None
|
||||
context["True"] = True
|
||||
context["False"] = False
|
||||
context["sitename"] = Config.objects.get(setting="sitename").value
|
||||
|
@ -878,7 +878,7 @@ def display_date(obj):
|
||||
else:
|
||||
return ""
|
||||
|
||||
def render(formfield, user, action, id=None):
|
||||
def render(formfield, user, action, id=None, url=None, *args):
|
||||
if not user.is_authenticated():
|
||||
action = "view"
|
||||
if action == "view": # show as text
|
||||
@ -888,7 +888,12 @@ def render(formfield, user, action, id=None):
|
||||
if (item.__class__.__name__ == 'ManyRelatedManager'):
|
||||
retval = ", ".join([i.get_link() for i in item.all()])
|
||||
else:
|
||||
retval = str(item)
|
||||
if url:
|
||||
retval = """<a href="%s">%s</a>""" % (url % args, item)
|
||||
elif hasattr(item, "get_link"):
|
||||
retval = item.get_link()
|
||||
else:
|
||||
retval = str(item)
|
||||
#### Some cleanup:
|
||||
if retval == "True":
|
||||
retval = "Yes"
|
||||
|
Loading…
Reference in New Issue
Block a user