Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More


Defines the TableRequest class.



sliced_data_iterator(qs, offset, limit)




TableRequest([actor, unused_request, ...])

A specialized ActionRequest whose actor is a table.

class lino.core.tablerequest.TableRequest(actor=None, unused_request=None, action=None, unused_renderer=None, rqdata=None, **kw)

Bases: ActionRequest

A specialized ActionRequest whose actor is a table.

gen_insert_button(target, button_attrs={'style': 'float: right;'}, **values)

Generate an insert button using a cached insertable object.

This is functionally equivalent to saying:

if self.insert_action is not None:
    ir = self.insert_action.request_from(ar)
    if ir.get_permission():
        return ir.ar2button()

The difference is that gen_insert_button is more efficient when you do this more than once during a single request.

target is the actor into which we want to insert an object. button_label is the optional button label. values is a dict of extra default values to apply to the insertable object.

First usage example is in lino_xl.lib.calview.


This will actually call the get_data_iterator() and run the database query.

Automatically called when either data_iterator or sliced_data_iterator is accesed.


Calling len() on a QuerySet would execute the whole SELECT. See /blog/2012/0124

parse_req(request, rqdata, **kw)

Parse the incoming HttpRequest and translate it into keyword arguments to be used by setup().

The mt url param is parsed only when needed. Usually it is not needed because the master_class is constant and known per actor. But there are exceptions:

row_as_paragraph(row, **kwargs)

Return a HTML string that represents the given row as a list item.

See Represent a row as a paragraph.

to_rst(*args, **kw)

Returns a string representing this table request in reStructuredText markup.

table2rst(*args, **kwargs)

Print a reStructuredText representation of this table request to stdout.


Return an HTML representation of this table request.

dump2html(tble, data_iterator, column_names=None, header_links=False, max_width=None, hide_sums=None)

Render this table into an existing etgen.html.Table instance. This central method is used by all Lino renderers.


tble An instance of etgen.html.Table.

data_iterator the iterable provider of table rows. This can be a queryset or a list.

column_names is an optional string with space-separated column names. If this is None, the table’s column_names is used.

header_links says whether to render column headers clickable with a link that sorts the table.

hide_sums : whether to hide sums. If this is not given, use the hide_sums of the actor.


Return a tuple (fields, headers, widths) which expresses which columns, headers and widths the user wants for this request. If self has web request info (request is not None), checks for GET parameters cn, cw and ch. Also calls the tables’s override_column_headers method.

row2text(fields, row, sums)

Render the given row into an iteration of text cells, using the given list of fields and collecting sums into sums.


Extends lino.core.requests.ActorRequest.get_status().