Refinements to events_table and css

svn: r13581
This commit is contained in:
Doug Blank 2009-11-14 23:48:55 +00:00
parent b5ca175f2b
commit 59af37944b
2 changed files with 20 additions and 8 deletions

View File

@ -314,6 +314,7 @@ table tr td.TableHeaderCell {
background-color: #f8eec9; background-color: #f8eec9;
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;
font-size: 0.8em;
margin:0; margin:0;
border-bottom:double 4px #7D5925; border-bottom:double 4px #7D5925;
border-left:solid 2px #7D5925; border-left:solid 2px #7D5925;
@ -324,6 +325,7 @@ table tr td.TableHeaderCell {
table tr td.TableDataCell { table tr td.TableDataCell {
color: #f8eec9; color: #f8eec9;
border:solid 2px #7D5925; border:solid 2px #7D5925;
font-size: 0.8em;
} }
table.infolist tr th a { table.infolist tr th a {

View File

@ -9,6 +9,7 @@ from gen.lib.date import Date as GDate, Today
from gen.plug import BasePluginManager from gen.plug import BasePluginManager
from cli.grampscli import CLIManager from cli.grampscli import CLIManager
from django.template import escape from django.template import escape
from django.contrib.contenttypes.models import ContentType
dji = libdjango.DjangoInterface() dji = libdjango.DjangoInterface()
@ -68,22 +69,31 @@ def events_table(djperson):
_("Date"), _("Date"),
_("Place"), _("Place"),
_("Role")) _("Role"))
person = table.db.get_person_from_handle(djperson.handle) obj_type = ContentType.objects.get_for_model(djperson)
event_list = table.access.events(person) event_ref_list = models.EventRef.objects.filter(
for event in event_list: object_id=djperson.id,
djevent = dji.Event.get(handle=event.handle) object_type=obj_type).order_by("order")
event_list = [(obj.ref_object, obj) for obj in event_ref_list]
for (djevent, event_ref) in event_list:
print djevent.description
table.row( table.row(
djevent.description, djevent.description,
djevent.event_type.name, str(djevent.event_type),
djevent.gramps_id, djevent.gramps_id,
table.access.event_date_obj(event), display_date(djevent),
table.access.event_place(event), get_title(djevent.place),
"FIXME") str(event_ref.role_type))
return table.get_html() return table.get_html()
## FIXME: these dji function wrappers just use the functions ## FIXME: these dji function wrappers just use the functions
## written for the import/export. Can be done much more directly. ## written for the import/export. Can be done much more directly.
def get_title(place):
if place:
return place.title
else:
return ""
def person_get_birth_date(person): def person_get_birth_date(person):
return person_get_event(person, models.EventType.BIRTH) return person_get_event(person, models.EventType.BIRTH)