The lino Package

Lino is a Python package to be used on Django sites. You probably won’t import lino directly, you just add a combination of lino.modlib.* modules to your INSTALLED_APPS.

lino.thanks_to()

The lino.reports Module

class lino.reports.Report

Bases: lino.core.actors.Actor, lino.ui.base.Handled

add_actions(*args)

Used in Model.setup_report() to specify actions for each report on this model.

ajax_update(request)
as_string(qs, max_items=10, format=<type 'unicode'>, separator=', ')

Returns this report as a unicode string.

Parameters:
  • max_items – don’t include more than
as_text(*args, **kw)
can_add

alias of is_authenticated

can_change

alias of is_authenticated

can_config

alias of is_staff

can_delete

alias of is_authenticated

can_view

alias of always

column_choices()
create_instance(req, **kw)
data_elems()
default_action_class

alias of GridEdit

disabled_fields

If disabled_fields is not None, it must be a method that accepts two arguments request and obj and returns a list of field names that should not be editable. See usage example in :class::dsbe.models.Persons and 20100804.

do_setup()
getLabel()
get_data_elem(name)
get_details()
get_grid_config_file()
get_master_kw(master_instance, **kw)
get_queryset(rr)
get_title(rr)
grid_configs

Will be filled during lino.reports.Report.do_setup().

request(ui=None, **kw)
row2dict(row, d)

Overridden by lino.modlib.properties.PropValuesByOwner. See also lino.ui.extjs.ext_requests.ViewReportRequest.

setup_request(req)
classmethod spawn(suffix, **kw)
unused_get_url(ui, **kw)
classmethod unused_register_page_layout(layout)
class lino.reports.ReportActionRequest(rh, action)

Bases: lino.actions.ActionRequest

create_instance(**kw)
get_queryset()
get_title()
get_user()
render_to_dict()
row2dict(row, d)
setup(master=None, master_instance=None, offset=None, limit=None, layout=None, user=None, extra=None, quick_search=None, gridfilters=None, order_by=None, selected_rows=None, **kw)
class lino.reports.ReportHandle(ui, report)

Bases: lino.core.datalinks.DataLink, lino.ui.base.Handle

get_absolute_url(*args, **kw)
get_action(name)
get_actions(*args, **kw)
get_details()
get_layout(i)
get_slaves()
get_title(rr)
get_used_layouts()
request(*args, **kw)
setup_layouts()
submit_elems()
lino.reports.add_gridfilters(qs, gridfilters)

Converts a filter request in the format used by Ext.ux.grid.GridFilters into a Django field lookup on a django.db.models.query.QuerySet.

Parameters:
  • qs – the queryset to be modified.
  • gridfilters – a list of dictionaries, each having 3 keys field, type and value.
lino.reports.add_quick_search_filter(qs, search_text)
lino.reports.base_attrs(cl)
lino.reports.column_choices(rptname)
lino.reports.de_verbose_name(de)
lino.reports.discover()
  • Each model can receive a number of “slaves”. Slaves are reports whose data depends on an instance of another model (their master).
  • For each model we want to find out the “model report” ot “default report”. The “choices report” for a foreignkey field is also currently simply the pointed model’s model_report. _lino_model_report
lino.reports.rc_name(rptclass)
lino.reports.register_report(rpt)
lino.reports.report_factory(model)
lino.reports.unused_rptname_choices()

The lino.actions Module

class lino.actions.Action(actor)
get_list_title(rh)
exception lino.actions.ActionEvent

Bases: exceptions.Exception

class lino.actions.ActionRequest(ah, action)

An ActionRequest will be created for every request.

alert(msg, **kw)
close_caller()
confirm(msg, **kw)
exception(e)
get_user()
notify(msg)
redirect(url)
refresh_caller()
refresh_menu()
run()
show_action_window(action)
unused_show_detail(row)
unused_show_modal_window(js)
unused_show_window(js)
class lino.actions.DeleteSelected(actor)

Bases: lino.actions.RowsAction

class lino.actions.GridEdit(rpt)

Bases: lino.actions.OpenWindowAction

class lino.actions.Hotkey(**kw)
class lino.actions.ImageAction(actor)

Bases: lino.actions.RedirectAction

get_target_url(elem)
class lino.actions.InsertRow(actor)

Bases: lino.actions.OpenWindowAction

get_list_title(rh)
class lino.actions.OpenWindowAction(actor)

Bases: lino.actions.WindowAction

class lino.actions.RedirectAction(actor)

Bases: lino.actions.Action

get_target_url(elem)
class lino.actions.RowsAction(actor)

Bases: lino.actions.Action

before_run(ar)
class lino.actions.ShowDetailAction(actor)

Bases: lino.actions.OpenWindowAction

get_elem_title(elem)
class lino.actions.SlaveGridAction(actor, slave)

Bases: lino.actions.ToggleWindowAction

class lino.actions.SubmitDetail(actor)

Bases: lino.actions.Action

class lino.actions.SubmitInsert(actor)

Bases: lino.actions.Action

class lino.actions.ToggleWindowAction(actor)

Bases: lino.actions.WindowAction

exception lino.actions.ValidationError

Bases: exceptions.Exception

class lino.actions.WindowAction(actor)

Bases: lino.actions.Action

run_action(ar)
class lino.actions.unused_ActionResponse(**kw)
as_dict()
class lino.actions.unused_SlaveDetailAction(actor, layout)

Bases: lino.actions.ToggleWindowAction

The lino.layouts Module

class lino.layouts.DataView(tpl)
class lino.layouts.DetailLayout

Bases: lino.layouts.ModelLayout

do_setup()
class lino.layouts.Layout

Bases: lino.core.actors.Actor

A Layout specifies how fields of a Report should be arranged when they are displayed in a form or a grid.

A layout descriptor is a plain text with some simple rules: - each word will lead to an element - ...todo...

get_hidden_elements(lh)
get_title(ar)
class lino.layouts.LayoutHandle(ui, layout)

Bases: lino.ui.base.Handle

LayoutHandle analyzes a Layout and builds a tree of LayoutElements.

add_hidden_field(field)
create_element(panelclass, desc_name)
desc2elem(panelclass, desc_name, desc, **kw)
ext_lines(request)
get_title(ar)
has_field(f)
setup_element(e)
splitdesc(picture)
unused__repr__()
walk()
write_debug_info()
class lino.layouts.ListLayout

Bases: lino.layouts.ModelLayout

unused_get_hidden_elements(lh)
class lino.layouts.ModelLayout

Bases: lino.layouts.Layout

do_setup()
class lino.layouts.StaticText(text)
lino.layouts.get_detail_layout(model)
lino.layouts.list_layout_factory(rpt)
class lino.layouts.unused_FormLayout

Bases: lino.layouts.Layout

The lino.lino_site Module

Importing this module will instantiate the LinoSite. This will automatically happen when your Django server gets its first web request because the urls.py of a Lino website contains:

from lino import lino_site
urlpatterns = patterns('',
    (r'', include(lino_site.get_urls())),
)

The LinoSite first makes sure that the django.db.models.loading.cache is populated. Then it analyzes the models and finds the corresponding Reports and Layouts.

class lino.lino_site.LinoSite
add_menu(*args, **kw)
add_program_menu()
context(request, **kw)
get_site_menu(user)
get_urls()
init_site_config(sc)
initdb(fixtures=[])
select_ui_view(request)
setup()

Subpackages