lino.core.tablerequest¶
Defines the TableRequest class.
Functions
|
|
|
Classes
|
|
|
|
|
A specialized |
- 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 atable
.- 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
.
- execute()¶
This will actually call the
get_data_iterator()
and run the database query.Automatically called when either
data_iterator
orsliced_data_iterator
is accesed.
- get_total_count()¶
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:
master is ContentType
master is some abstract model
master is not a subclass of Model, e.g.
lino_xl.lib.polls.AnswersByResponse
, a virtual table that definesget_row_by_pk
.
- row_as_paragraph(row, **kwargs)¶
Return a HTML string that represents the given row as a list item.
- 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.
- table2xhtml(**kwargs)¶
Return an HTML representation of this table request.
- dump2html(tble, data_iterator, column_names=None, header_links=False, hide_sums=None)¶
Render this table into an existing
etgen.html.Table
instance. This central method is used by all Lino renderers.Arguments:
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 theactor
.
- get_field_info(column_names=None)¶
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'soverride_column_headers
method.
- row2text(fields, row, sums)¶
Render the given row into a line of text, using the given list of fields and collecting sums into sums.
- get_status(**kw)¶
Extends
lino.core.requests.ActorRequest.get_status()
.