Infrastructure to allow going back to browse page; deleted unneeded templates

svn: r19756
This commit is contained in:
Doug Blank 2012-06-04 20:58:05 +00:00
parent 186c686296
commit d62afc815f
19 changed files with 105 additions and 236 deletions

View File

@ -1,5 +1,6 @@
{% load my_tags %} {% load my_tags %}
{% filter breadcrumb %}
{% filter breadcrumb %} {% format "/browse|Browse" %}||
{% format "/browse|Browse,/%s|%s,/%s/%s|%s [%s]" view tviews view object.handle tview object.gramps_id %} {% format "/%s/%s|%s" view args tviews %}||
{% endfilter %} {% format "/%s/%s|%s [%s]" view object.handle tview object.gramps_id %}
{% endfilter %}

View File

@ -1,31 +0,0 @@
{% extends "base.html" %}
{% block windowtitle %}Person Details{% endblock %}
{% block pagetitle %}{{Pname}}{% endblock %}
{% block content %}
<form name="input" action={{URL}} method="post">{% csrf_token %}
<table cellspacing = "2">
<tr><td colspan = "2">Preferred Name</td></tr>
{% for field in NForm %}
<div class="fieldWrapper"><tr>
<td width="10"></td>
<td>{{ field.label_tag }}: </td>
<td width="300">{{ field }}<p>{{ field.help_text }}</p></td>
<td>{{ field.errors }}</td>
</tr></div>
{% endfor %}
</table>
<table cellspacing = "2">
{% for field in PForm %}
<div class="fieldWrapper"><tr>
<td>{{ field.label_tag }}: </td>
<td width="300">{{ field }}<p>{{ field.help_text }}</p></td>
<td>{{ field.errors }}</td>
</tr></div>
{% endfor %}
</table>
<input type="submit" value="Save & Exit" />
</form>
{% endblock %}

View File

@ -1,69 +0,0 @@
{% extends "base.html" %}
{% block windowtitle %}Person Details{% endblock %}
{% block pagetitle %}{{Pname}}{% endblock %}
{% block content %}
<form name="input" action={{URL}} method="post">{% csrf_token %}
{{ NForm.management_form }}
Names (<a id="displayText" href="javascript:toggle('nameset','show');">hide</a>)
<div id="nameset" style="display: block">
<table class="nicetable">
<tr>
<td>Preferred Name?</td>
<td>Prefix</td>
<td>First Name</td>
<td>Surname</td>
<td>Suffix</td>
<td>Type of Name</td>
<td>Delete</td>
</tr>
{% for form in NForm.forms %}
<tr>
{% for field in form %}
<td><p>{{ field }}</p>
<div id="errmsg"><p>{{ field.errors }}</p></div></td>
{% endfor %}
</tr>
{% endfor %}
<tr><td colspan="7"><div id="errmsg">{{ NamesetError }}</div></td></tr>
</table></div>
<table class="nicetable">
<tr>
<td>Reference ID: {{PForm.gramps_id}}</td>
<td>{{PForm.private}} Private </td>
<td>Last Changed: {{PLastChanged}}
<div id="errmsg"><p>{{PForm.last_changed.errors}}</p></div></td>
</tr><tr>
<td>Marker: {{PForm.marker_type}}
<div id="errmsg"><p>{{PForm.marker_type.errors}}</p></div></td>
<td>Gender: {{PForm.gender_type}}
<div id="errmsg"><p>{{PForm.gender_type.errors}}</p></div></td>
</tr><tr>
<td><p>Parent in these families:
(<a id="displayText" href="javascript:toggle('families','Edit');">
Edit</a>)</p><ul>{% for family in ParentF %}
<li>{{family}}</li>
{% endfor %}</ul></td>
<td><p>Child in these families:
(<a id="displayText" href="javascript:toggle('pfamilies','Edit');"> Edit</a>)</p><ul>{% for family in ChildF %}
<li>{{family}}</li>
{% endfor %}</ul></td>
</tr>
</table>
<table class="nicetable">
<tr><td width = "300"><div id="families" style="display: none">
<p>{{PForm.families}}</p>
<p>{{PForm.families.help_text}}</p>
<p>{{PForm.famlies.errors}}</p></div></td>
<td width = "300"><div id="pfamilies" style="display: none">
<p>{{PForm.parent_families}}</p>
<p>{{PForm.parent_families.help_text}}</p>
<p>{{PForm.parent_famlies.errors}}</p></div></td></tr>
</table>
<input type="submit" value="Save & Exit" />
</form>
{% endblock %}

View File

@ -1,9 +0,0 @@
{% extends "base.html" %}
{% block windowtitle %}Places{% endblock %}
{% block pagetitle %}Places{% endblock %}
{% block content %}
Congratulations, you found Places
{% endblock %}

View File

@ -1,49 +0,0 @@
{{ NForm.management_form }}
<table cellspacing = "2">
<tr><td colspan = "2">Names:</td></tr>
<tr><td width="10"></td>
<td><label>Preferred Name?</label></td>
<td width="50"><label>Prefix</label></td>
<td><label>First Name</label></td>
<td><label>Surname</label></td>
<td><label>Suffix</label></td>
<td><label>Type of Name</label></td>
<td><label>Delete</label></td>
</tr>
{% for form in NForm.forms %}
<div class="fieldWrapper"><tr>
<td width="10"></td>
{% for field in form %}
<td align="center">{{ field }}</td>
{% endfor %}
</tr></div>
<tr><td colspan="5>{{form.errors}}</td></tr>
{% endfor %}
</table>
{% for field in PForm %}
<div class="fieldWrapper"><tr>
<td>{{ field.label_tag }}: </td>
<td width="300">{{ field }}<p>{{ field.help_text }}</p></td>
<td>{{ field.errors }}</td>
</tr></div>
{% endfor %}
{{ NForm.management_form }}
<table>
<td>Preferred Name?</td>
<td>Prefix</td>
<td>First Name</td>
<td>Surname</td>
<td>Suffix</td>
<td>Type of Name</td>
<td>Delete</td>
</tr>
{% for form in NForm.forms %}
{% for field in form %}
<td align="left">{{ field }}<p>{{ field.errors }}</p></td>
{% endfor %}
</tr>
<tr><td colspan="7"></td></tr>
{% endfor %}
</table>

View File

@ -1,10 +0,0 @@
{% extends "view_page_detail.html" %}
{% load my_tags %}
{% block windowtitle %}Process Action{% endblock %}
{% block pagetitle %}Process Action{% endblock %}
{% block content %}
{{message}}
{% endblock %}

View File

@ -1,9 +0,0 @@
{% extends "base.html" %}
{% block windowtitle %}Data Changes Successfully Saved{% endblock %}
{% block pagetitle %}Data Changes Successfully Saved{% endblock %}
{% block content %}
Congratulations, your data changes were successful!
{% endblock %}

View File

@ -1,10 +0,0 @@
{% extends "gramps-base.html" %}
{% block title %}{{sitename}}: {{tview}} detail {% endblock %}
{% block heading %}{{sitename}}: {{tview}} detail {% endblock %}
{% block content %}
{{tview}} Detail page.
{% endblock %}

View File

@ -16,10 +16,12 @@
<div class="content" id="IndividualDetail"> <div class="content" id="IndividualDetail">
{% filter breadcrumb %} {% filter breadcrumb %}
{% format "/browse|Browse,/person|People,/person/%s|Person [%s],/person/%s/name/%s|Name #%s" object.handle object.gramps_id object.handle order order %} {% format "/browse|Browse" %} ||
{% format "/person|People" %} ||
{% format "/person/%s|Person [%s]" object.handle object.gramps_id %} ||
{% format "/person/%s/name/%s|Name #%s" object.handle order order %}
{% endfilter %} {% endfilter %}
<h3>{{nameform.model|make_name:user}} [{{person.gramps_id}}]</h3> <h3>{{nameform.model|make_name:user}} [{{person.gramps_id}}]</h3>
<div id="summaryarea"> <div id="summaryarea">
<table class="infolist" style="width:90%;"> {% comment %} 4 cols {% endcomment %} <table class="infolist" style="width:90%;"> {% comment %} 4 cols {% endcomment %}

View File

@ -10,7 +10,8 @@
<form name="SearchForm"> <form name="SearchForm">
{% if tview != "Report" %} {% if tview != "Report" %}
{% filter breadcrumb %} {% filter breadcrumb %}
{% format "/browse|Browse,/%s|%s" view tviews %} {% format "/browse|Browse" %} ||
{% format "/%s|%s" view tviews %}
{% endfilter %} {% endfilter %}
{% endif %} {% endif %}
<input type="submit" value="Search:"></input> <input type="submit" value="Search:"></input>

View File

@ -18,14 +18,14 @@
{% for name in page.object_list %} {% for name in page.object_list %}
<tr class="{% cycle odd,even %}"> <tr class="{% cycle odd,even %}">
{% if name.person %} {% if name.person %}
<td><a href="{{name.person.handle}}/" class="noThumb browsecell">{{ forloop.counter|row_count:page }}</a> <td><a href="{{name.person.handle}}/{{args}}" class="noThumb browsecell">{{ forloop.counter|row_count:page }}</a>
</td> </td>
<td><a href="{{name.person.handle}}/" class="noThumb browsecell">{{name|make_name:user}} &nbsp;</a> <td><a href="{{name.person.handle}}/{{args}}" class="noThumb browsecell">{{name|make_name:user}} &nbsp;</a>
</td> </td>
<td><a href="{{name.person.handle}}/" class="grampsid browsecell">[{{name.person.gramps_id}}]</a></td> <td><a href="{{name.person.handle}}/{{args}}" class="grampsid browsecell">[{{name.person.gramps_id}}]</a></td>
<td><a href="{{name.person.handle}}/" class="noThumb browsecell">{{name.person.gender_type}} &nbsp;</a></td> <td><a href="{{name.person.handle}}/{{args}}" class="noThumb browsecell">{{name.person.gender_type}} &nbsp;</a></td>
<td><a href="{{name.person.handle}}/" class="noThumb browsecell">{{name.person.birth|date_as_text:user}} &nbsp;</a></td> <td><a href="{{name.person.handle}}/{{args}}" class="noThumb browsecell">{{name.person.birth|date_as_text:user}} &nbsp;</a></td>
<td><a href="{{name.person.handle}}/" class="noThumb browsecell">{{name.person.death|date_as_text:user}} &nbsp;</a></td> <td><a href="{{name.person.handle}}/{{args}}" class="noThumb browsecell">{{name.person.death|date_as_text:user}} &nbsp;</a></td>
{% endif %} {% endif %}
</tr> </tr>
{% endfor %} {% endfor %}
@ -33,7 +33,7 @@
</table> </table>
{% if user.is_superuser %} {% if user.is_superuser %}
{% make_button "Add Person" "/person/add" %} {% make_button "Add Person" "/person/add" args %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -133,18 +133,22 @@
{% if user.is_superuser %} {% if user.is_superuser %}
{% if action == "edit" %} {% if action == "edit" %}
{% make_button "Cancel" "/person/%s" person.handle %} {% make_button "Cancel" "/person/%s" person.handle args %}
<input type="hidden" name="action" value="save"/> <input type="hidden" name="action" value="save"/>
<input type="hidden" name="search" value="{{search}}"/>
<input type="hidden" name="page" value="{{page}}"/>
<input type="submit" value="Save"/> <input type="submit" value="Save"/>
{% else %} {% else %}
{% ifequal action "add" %} {% ifequal action "add" %}
{% make_button "Cancel" "/person/" %} {% make_button "Cancel" "/person/" %}
<input type="hidden" name="action" value="create"/> <input type="hidden" name="action" value="create"/>
<input type="hidden" name="search" value="{{search}}"/>
<input type="hidden" name="page" value="{{page}}"/>
<input type="submit" value="Create"/> <input type="submit" value="Create"/>
{% else %} {% else %}
{% make_button "Add Person" "/person/add" %} {% make_button "Add Person" "/person/add" args %}
{% make_button "Edit Person" "/person/%s/edit" person.handle %} {% make_button "Edit Person" "/person/%s/edit" person.handle args %}
{% make_button "Delete Person" "/person/%s/delete" person.handle %} {% make_button "Delete Person" "/person/%s/delete" person.handle args %}
{% endifequal %} {% endifequal %}
{% endif %} {% endif %}
{% else %} {% else %}

View File

@ -16,10 +16,12 @@
<div class="content" id="IndividualDetail"> <div class="content" id="IndividualDetail">
{% filter breadcrumb %} {% filter breadcrumb %}
{% format "/browse|Browse,/person|People,/person/%s|Person [%s],/person/%s/name/%s|Name #%s" object.handle object.gramps_id object.handle order order %} {% format "/browse|Browse" %} ||
{% format "/person|People" %} ||
{% format "/person/%s|Person [%s]" object.handle object.gramps_id %} ||
{% format "/person/%s/name/%s|Name #%s" object.handle order order %}
{% endfilter %} {% endfilter %}
<h3>{{person|make_name:user}} [{{person.gramps_id}}]</h3> <h3>{{person|make_name:user}} [{{person.gramps_id}}]</h3>
<div id="summaryarea"> <div id="summaryarea">
<table class="infolist" style="width:90%;"> {% comment %} 4 cols {% endcomment %} <table class="infolist" style="width:90%;"> {% comment %} 4 cols {% endcomment %}

View File

@ -24,8 +24,6 @@
from webapp.grampsdb.models import * from webapp.grampsdb.models import *
from django.contrib import admin from django.contrib import admin
print dir(admin.ModelAdmin)
class MyAdmin(admin.ModelAdmin): class MyAdmin(admin.ModelAdmin):
def change_view(self, request, object_id, extra_context=None): def change_view(self, request, object_id, extra_context=None):
print "object_id:", object_id print "object_id:", object_id

View File

@ -645,6 +645,12 @@ class Surname(models.Model):
def __unicode__(self): def __unicode__(self):
return "%s" % self.surname return "%s" % self.surname
def get_url(self):
# /person/handle/name/1/surname/2
return "/person/%s/name/%s/surname/%s" % (self.name.person.handle,
self.name.order,
self.order)
class Name(DateObject, SecondaryObject): class Name(DateObject, SecondaryObject):
name_type = models.ForeignKey('NameType', verbose_name="Type", name_type = models.ForeignKey('NameType', verbose_name="Type",
related_name="name_code", related_name="name_code",
@ -693,6 +699,10 @@ class Name(DateObject, SecondaryObject):
tuple(x.name_origin_type), x.connector) for x in tuple(x.name_origin_type), x.connector) for x in
self.surname_set.all()] self.surname_set.all()]
def get_url(self):
# /person/handle/name/1
return "/person/%s/name/%s" % (self.person.handle, self.order)
class Lds(DateObject, SecondaryObject): class Lds(DateObject, SecondaryObject):
""" """
BAPTISM = 0 BAPTISM = 0

View File

@ -149,11 +149,11 @@ def breadcrumb(path, arg=None):
if arg: if arg:
path = path.replace("{0}", arg) path = path.replace("{0}", arg)
retval = "" retval = ""
for item in path.split(","): for item in path.split("||"):
p, name = item.split("|") p, name = item.split("|", 1)
if retval != "": if retval != "":
retval += " > " retval += " > "
retval += '<a href="%s"><b>%s</b></a>' % (p, name) retval += '<a href="%s"><b>%s</b></a>' % (p.strip(), name.strip())
return "<p>%s</p>" % retval return "<p>%s</p>" % retval
breadcrumb.is_safe = True breadcrumb.is_safe = True
register.filter('breadcrumb', breadcrumb) register.filter('breadcrumb', breadcrumb)
@ -181,6 +181,11 @@ def format(string, arg0=None, arg1=None, arg2=None, arg3=None, arg4=None, arg5=N
format.is_safe = True format.is_safe = True
register.simple_tag(format) register.simple_tag(format)
def make_args(search, page):
return webapp.utils.build_args(search=search, page=page)
make_args.is_safe = True
register.simple_tag(make_args)
def currentSection(view1, view2): # tview, menu def currentSection(view1, view2): # tview, menu
if view1.strip().lower() in [view[1] for view in VIEWS] and view2 == "browse": if view1.strip().lower() in [view[1] for view in VIEWS] and view2 == "browse":
return "class=CurrentSection" return "class=CurrentSection"

View File

@ -22,7 +22,7 @@
""" Views for Person, Name, and Surname """ """ Views for Person, Name, and Surname """
## Gramps Modules ## Gramps Modules
from webapp.utils import _, boolean, update_last_changed from webapp.utils import _, boolean, update_last_changed, build_search
from webapp.grampsdb.models import Person, Name, Surname from webapp.grampsdb.models import Person, Name, Surname
from webapp.grampsdb.forms import * from webapp.grampsdb.forms import *
from webapp.libdjango import DjangoInterface from webapp.libdjango import DjangoInterface
@ -146,7 +146,8 @@ def process_surname(request, handle, order, sorder, action="view"):
neworder += 1 neworder += 1
else: else:
request.user.message_set.create(message="You can't delete the only surname") request.user.message_set.create(message="You can't delete the only surname")
return redirect("/person/%s/name/%s#tab-surnames" % (person.handle, name.order)) return redirect("/person/%s/name/%s%s#tab-surnames" % (person.handle, name.order,
build_search(request)))
elif action in ["add"]: elif action in ["add"]:
surname = Surname(name=name, primary=False, surname = Surname(name=name, primary=False,
name_origin_type=NameOriginType.objects.get(val=NameOriginType._DEFAULT[0])) name_origin_type=NameOriginType.objects.get(val=NameOriginType._DEFAULT[0]))
@ -166,8 +167,9 @@ def process_surname(request, handle, order, sorder, action="view"):
surname = sf.save(commit=False) surname = sf.save(commit=False)
check_primary(surname, surnames) check_primary(surname, surnames)
surname.save() surname.save()
return redirect("/person/%s/name/%s/surname/%s#tab-surnames" % return redirect("/person/%s/name/%s/surname/%s%s#tab-surnames" %
(person.handle, name.order, sorder)) (person.handle, name.order, sorder,
build_search(request)))
action = "add" action = "add"
surname.prefix = make_empty(True, surname.prefix, " prefix ") surname.prefix = make_empty(True, surname.prefix, " prefix ")
elif action == "save": elif action == "save":
@ -179,13 +181,14 @@ def process_surname(request, handle, order, sorder, action="view"):
surname = sf.save(commit=False) surname = sf.save(commit=False)
check_primary(surname, name.surname_set.all().exclude(order=surname.order)) check_primary(surname, name.surname_set.all().exclude(order=surname.order))
surname.save() surname.save()
return redirect("/person/%s/name/%s/surname/%s#tab-surnames" % return redirect("/person/%s/name/%s/surname/%s%s#tab-surnames" %
(person.handle, name.order, sorder)) (person.handle, name.order, sorder,
build_search(request)))
action = "edit" action = "edit"
surname.prefix = make_empty(True, surname.prefix, " prefix ") surname.prefix = make_empty(True, surname.prefix, " prefix ")
# else, edit again # else, edit again
else: else:
raise raise Exception("unknown action: '%s'" % action)
sf = SurnameForm(instance=surname) sf = SurnameForm(instance=surname)
sf.model = surname sf.model = surname
@ -209,7 +212,7 @@ def process_name(request, handle, order, action="view"):
if request.POST.has_key("action"): if request.POST.has_key("action"):
action = request.POST.get("action") action = request.POST.get("action")
### Process action: ### Process action:
if action == "view": if action in "view":
pf, nf, sf, person = get_person_forms(handle, order=order) pf, nf, sf, person = get_person_forms(handle, order=order)
name = nf.model name = nf.model
elif action == "edit": elif action == "edit":
@ -224,7 +227,8 @@ def process_name(request, handle, order, action="view"):
check_order(request, person) check_order(request, person)
else: else:
request.user.message_set.create(message = "Can't delete only name.") request.user.message_set.create(message = "Can't delete only name.")
return redirect("/person/%s#tab-names" % person.handle) return redirect("/person/%s%s#tab-names" % (person.handle,
build_search(request)))
elif action == "add": # add name elif action == "add": # add name
person = Person.objects.get(handle=handle) person = Person.objects.get(handle=handle)
name = Name(person=person, name = Name(person=person,
@ -275,7 +279,8 @@ def process_name(request, handle, order, action="view"):
surname.primary = True # FIXME: why is this False? surname.primary = True # FIXME: why is this False?
surname.save() surname.save()
dji.rebuild_cache(person) dji.rebuild_cache(person)
return redirect("/person/%s/name/%s#tab-surnames" % (person.handle, name.order)) return redirect("/person/%s/name/%s%s#tab-surnames" % (person.handle, name.order,
build_search(request)))
else: else:
action = "add" action = "add"
elif action == "save": elif action == "save":
@ -309,7 +314,8 @@ def process_name(request, handle, order, action="view"):
surname.primary = True # FIXME: why is this False? surname.primary = True # FIXME: why is this False?
surname.save() surname.save()
dji.rebuild_cache(person) dji.rebuild_cache(person)
return redirect("/person/%s/name/%s#tab-surnames" % (person.handle, name.order)) return redirect("/person/%s/name/%s%s#tab-surnames" % (person.handle, name.order,
build_search(request)))
else: else:
action = "edit" action = "edit"
context = RequestContext(request) context = RequestContext(request)
@ -342,7 +348,7 @@ def process_person(request, context, handle, action, add_to=None): # view, edit,
elif action == "delete": elif action == "delete":
pf, nf, sf, person = get_person_forms(handle, protect=False, empty=True) pf, nf, sf, person = get_person_forms(handle, protect=False, empty=True)
person.delete() person.delete()
return redirect("/person/") return redirect("/person/%s" % build_search(request))
elif action in ["save", "create"]: # could be create a new person elif action in ["save", "create"]: # could be create a new person
# look up old data, if any: # look up old data, if any:
if handle: if handle:
@ -391,8 +397,8 @@ def process_person(request, context, handle, action, add_to=None): # view, edit,
model = dji.get_model(item) model = dji.get_model(item)
obj = model.objects.get(handle=handle) obj = model.objects.get(handle=handle)
dji.add_person_ref_default(obj, person) dji.add_person_ref_default(obj, person)
return redirect("/%s/%s" % (item, handle)) return redirect("/%s/%s%s" % (item, handle, build_search(request)))
return redirect("/person/%s" % person.handle) return redirect("/person/%s%s" % (person.handle, build_search(request)))
else: else:
# need to edit again # need to edit again
if handle: if handle:

View File

@ -54,7 +54,7 @@ from django.forms.models import modelformset_factory
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import webapp import webapp
from webapp.utils import _ from webapp.utils import _, build_args
from webapp.grampsdb.models import * from webapp.grampsdb.models import *
from webapp.grampsdb.view import * from webapp.grampsdb.view import *
from webapp.dbdjango import DbDjango from webapp.dbdjango import DbDjango
@ -102,6 +102,12 @@ def context_processor(request):
context["False"] = False context["False"] = False
context["sitename"] = Config.objects.get(setting="sitename").value context["sitename"] = Config.objects.get(setting="sitename").value
context["default"] = "" context["default"] = ""
search = request.GET.get("search", None) or request.POST.get("search", None)
page = request.GET.get("page", None) or request.POST.get("page", None)
context["page"] = page
context["search"] = search
context["args"] = build_args(search=search, page=page)
return context return context
def main_page(request): def main_page(request):

View File

@ -227,10 +227,36 @@ class Table(object):
# We have a couple of HTML bits that we want to unescape: # We have a couple of HTML bits that we want to unescape:
return str(self.doc.doc.htmllist[0]).replace("&amp;nbsp;", "&nbsp;") return str(self.doc.doc.htmllist[0]).replace("&amp;nbsp;", "&nbsp;")
def build_args(**kwargs):
retval = ""
first = True
for key in kwargs:
if kwargs[key] is not None:
if first:
retval+= "?"
first = False
else:
retval += "&"
retval += "%s=%s" % (key, kwargs[key])
return retval
def build_search(request):
search = request.GET.get("search", None) or request.POST.get("search", None)
page = request.GET.get("page", None) or request.POST.get("page", None)
return build_args(search=search, page=page)
def make_button(text, url, *args): def make_button(text, url, *args):
url = url % args newargs = []
#return """[ <a href="%s">%s</a> ] """ % (url, text) kwargs = ""
return """<input type="button" value="%s" onclick="document.location.href='%s'"/>""" % (text, url) for arg in args:
if arg.startswith("?"):
kwargs = arg
elif arg == "":
pass
else:
newargs.append(arg)
url = url % tuple(newargs)
return mark_safe("""<input type="button" value="%s" onclick="document.location.href='%s%s'"/>""" % (text, url, kwargs))
def event_table(obj, user, action, url, args): def event_table(obj, user, action, url, args):
retval = "" retval = ""
@ -314,13 +340,8 @@ def surname_table(obj, user, action, url=None, *args):
except: except:
name = None name = None
if name: if name:
links = []
for surname in name.surname_set.all().order_by("order"): for surname in name.surname_set.all().order_by("order"):
table.row(str(surname.order), surname.surname) table.row(str(surname.order), surname)
links.append(('URL',
# url is "/person/%s/name/%s/surname"
(url % args) + ("/%s" % surname.order)))
table.links(links)
retval += table.get_html() retval += table.get_html()
else: else:
retval += "<p id='error'>No such name order = %s</p>" % order retval += "<p id='error'>No such name order = %s</p>" % order