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;
font-weight: bold;
text-align: left;
font-size: 0.8em;
margin:0;
border-bottom:double 4px #7D5925;
border-left:solid 2px #7D5925;
@ -324,6 +325,7 @@ table tr td.TableHeaderCell {
table tr td.TableDataCell {
color: #f8eec9;
border:solid 2px #7D5925;
font-size: 0.8em;
}
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 cli.grampscli import CLIManager
from django.template import escape
from django.contrib.contenttypes.models import ContentType
dji = libdjango.DjangoInterface()
@ -68,22 +69,31 @@ def events_table(djperson):
_("Date"),
_("Place"),
_("Role"))
person = table.db.get_person_from_handle(djperson.handle)
event_list = table.access.events(person)
for event in event_list:
djevent = dji.Event.get(handle=event.handle)
obj_type = ContentType.objects.get_for_model(djperson)
event_ref_list = models.EventRef.objects.filter(
object_id=djperson.id,
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(
djevent.description,
djevent.event_type.name,
str(djevent.event_type),
djevent.gramps_id,
table.access.event_date_obj(event),
table.access.event_place(event),
"FIXME")
display_date(djevent),
get_title(djevent.place),
str(event_ref.role_type))
return table.get_html()
## FIXME: these dji function wrappers just use the functions
## 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):
return person_get_event(person, models.EventType.BIRTH)