This defines the
The base class for all plugin descriptors.
- class lino.core.plugin.Plugin(site, app_label, app_name, app_module, needed_by, configs: dict)¶
The base class for all plugin descriptors.
- needs_plugins = ¶
A list of names of plugins needed by this plugin.
The default implementation of
get_required_plugins()returns this list.
- extends_models = None¶
If specified, a list of model names for which this app provides a subclass.
For backwards compatibility this has no effect when
The name of another plugin to be used as menu group.
- media_base_url = None¶
Remote URL base for media files.
- media_name = None¶
Either None (default) or a non-empty string with the name of the subdirectory of your
mediadirectory which is expected to contain media files for this app.
None means that there this app has no media files of her own.
Best practice is to set this to the app_label. Will be ignored if
- url_prefix = None¶
The url prefix under which this plugin should ask to install its url patterns.
- site_js_snippets = ¶
List of js snippets to be injected into the lino_*.js file.
- support_async = False¶
Whether this plugin uses
Whether this plugin is hidden.
- needed_by = None¶
If not None, then it is the Plugin instance that caused this plugin to automatically install. As the application developer you do not set this yourself
- verbose_name = None¶
The verbose name of this plugin, as shown to the user. This can be a lazily translated string.
- short_name = None¶
The abbreviated name of this plugin, shown to the user in places where shortness is important, e.g. as the label of the tabs of a detail layout. This can be a lazily translated string. Defaults to
Set the given parameter(s) of this Plugin instance. Any number of parameters can be specified as keyword arguments.
Raise an exception if caller specified a key that does not have a corresponding attribute.
Return a list of names of plugins needed by this plugin.
The default implementation returns
Lino will automatically install these plugins if necessary.
Note that Lino will add them before your plugin.
Note that only the app_label (not the full plugin name) is used when testing whether a plugin is installed. In other words, if a plugin says it requires a plugin "stdlib.foo" and an application already has some plugin "mylib.foo" installed, then "mylib.foo" satisfies "stdlib.foo".
Yield a series of tuples (verbose_name, version, url) that describe the libraries used by this Lino site.
This will be called when the Plugin is being instantiated (i.e. even before the
Siteinstantiation has finished. Used by
Called exactly once on each installed plugin, when the
Sitehas loaded all plugins, but before calling
setup_plugins(). All this happens before settings are ready and long before the models modules start to load.
This is used for initializing default values of plugin attributes that (a) depend on other plugins but (b) should be overridable in
groupsuses this to set a default value to the
lino.modlib.checkdatauses it to set responsible_user to "robin" when it is a demo site.
This is called exactly once when models are ready.
This is called exactly once during site startup, when models are ready. Used by lino.modlib.help
This will be called exactly once, when models are ready.
- classmethod extends_from()¶
Return the plugin from which this plugin inherits.
- classmethod get_subdir(name)¶
Get the absolute path of the named subdirectory if it exists.
This is called during startup, when all models modules have been imported, and before Lino starts to analyze them.
This is called when the kernel is being instantiated.
Override this to return a list of url patterns to be added to the Site's patterns.
- get_requirements(site) Iterable[str] ¶
Return a list of optionally required Python packages to be installed during
See also About requirements.
- get_head_lines(site, request)¶
Yield or return a list of textlines to add to the <head> of the html page.
- on_initdb(site, force=False, verbosity=1)¶
This is called during SITE.build_site_cache().
This returns self by default, unless
this plugin defines an explicit
menu_group. In this case return the named plugin.
this plugin was automatically installed because some other plugin needs it. In this case return that other plugin.
Return or yield a sequence of quick link descriptors to be added to the list of quick links.
A quick link descriptor is a string that identifies either an actor or a bound action.
Add quicklinks to the list of quick links.
Return or yield a sequence of items to be rendered on the dashboard.
Tables are shown with a limit of