diff --git a/src/gen/simple/_simpletable.py b/src/gen/simple/_simpletable.py index 50147ae4c..dcf95b90a 100644 --- a/src/gen/simple/_simpletable.py +++ b/src/gen/simple/_simpletable.py @@ -188,11 +188,14 @@ class SimpleTable(object): else: self._rows.sort(lambda a, b: cmp(a[idx],b[idx])) - def write(self, document): + def write(self, document, column_widths=None): doc = document.doc columns = len(self._columns) doc.start_table('simple', 'Table') - doc._tbl.set_column_widths([100/columns] * columns) + if column_widths: + doc._tbl.set_column_widths(column_widths) + else: + doc._tbl.set_column_widths([100/columns] * columns) doc._tbl.set_columns(columns) if self.title: doc.start_row() diff --git a/src/webapp/utils.py b/src/webapp/utils.py index 7e6b57e1c..560806b2f 100644 --- a/src/webapp/utils.py +++ b/src/webapp/utils.py @@ -205,6 +205,7 @@ class Table(object): self.db = DbDjango() self.access = SimpleAccess(self.db) self.table = SimpleTable(self.access) + self.column_widths = None class Doc(object): def __init__(self, doc): self.doc = doc @@ -249,7 +250,7 @@ class Table(object): def get_html(self): # The HTML writer escapes data: - self.table.write(self.doc) # forces to htmllist + self.table.write(self.doc, self.column_widths) # forces to htmllist # FIXME: do once, or once per table? self.doc.doc.build_style_declaration(self.id) # can pass id, for whole # FIXME: don't want to repeat this, unless diff for each table: @@ -837,6 +838,7 @@ def children_table(obj, user, act, url=None, *args): _("Maternal"), _("Birth Date"), ) + table.column_widths = [3] + [98/6] * 6 family = obj obj_type = ContentType.objects.get_for_model(family)