Skip to content

API Reference

Auto-generated API documentation from the MedUX source code.

Core Interfaces

medux.core.api.interfaces

medux.core.api.interfaces.ICommand

Bases: Interface

A CommandLine command that executes a defined function on a shortcut.

A written command could be m dicl 75 what means the "m" command with could be parsed as "medication" command with a search for "Diclofenac 75mg Tbl".

medux.core.api.interfaces.IDashboardWidgetArea

Bases: IWidgetArea

Main dashboard widget area.

medux.core.api.interfaces.IGlobalJavascript

Bases: Interface

Interface for adding Js file to a global scope.

The given file will be loaded in the global context and is then available to all other plugins too, in every loaded page. Be aware just to add Js code that is small and fast, to not blow up the application as whole.

You have to specify the (relative to static dir) file path of the Js script in the file attribute.

file = '' class-attribute instance-attribute

The (relative to static dir) file path of the Js script

Common Interfaces

medux.common.api.interfaces

medux.common.api.interfaces.IAdministrationSection

Bases: Interface

A self-contained section on the MedUX /administration/ area.

Plugins implement this interface to contribute a full-fledged administration sub-area (user/group/role management, audit log, maintenance tools, …). Each section owns its own URL patterns, permission gating, and a menu entry on the left administration rail.

This is intentionally separate from conjunto's ISettingsSection:

  • ISettingsSection lives on the /settings/ page and is limited to rendering one or more ISettingsForm subsections on the right pane. It is form-shaped.
  • IAdministrationSection owns arbitrary views — list tables, wizards, CRUD flows, modal dialogs — all hosted under /adm/.

Example:

class UserRolesAdministrationSection(IAdministrationSection):
    namespace = "tenant"
    name = "user_roles"
    title = _("User roles")
    icon = "shield-lock"
    weight = 20
    parent_slug = "tenant"
    menu_slug = "tenant__user_roles"
    tenant_admin_required = True
    url_name = "user-roles-list"
    urlpatterns = [
        path("users/", UserRolesListView.as_view(), name="user-roles-list"),
        ...
    ]

get_url() classmethod

Reverse the section's entry URL under the adm namespace.

has_permission(request) classmethod

Whether request.user may enter this section.

AND-combines :attr:permission_required (if set) and :attr:tenant_admin_required (if set). A superuser always passes.

medux.common.api.interfaces.ILoginFormExtension

Bases: IViewExtension

Hook for FormExtensions for the MedUX login form.

TODO: Migrate to PluginFormMixin API from gdaps.

medux.common.api.interfaces.ILoginViewExtension

Bases: IViewExtension

Hook for LoginView extensions

medux.common.api.interfaces.IWebsocketURL

Bases: Interface

URL patterns for websockets, to be extended by plugins.

Plugins can define their own websocket URL patterns by declaring a IWebsocketURL:

class MyWebsocketURL(IWebsocketURL): websocket_urlpatterns = [ path('message//', consumers.MessageConsumer.as_asgi()), ]

All these patterns will then be concatenated to the URL pattern of the main application and fed into the websocket handler.

medux.common.api.interfaces.MeduxPluginAppConfig

Bases: AppConfig

Common base class for all MedUX AppConfigs.

All MedUX apps' AppConfigs must inherit from this class (or must at least implement this interface).

compatibility_errors()

checks for compatibility issues that can't be ignored for correct application function, and returns a list of errors.

Returns:

Type Description
List[str]

A list of error strs

compatibility_warnings()

Checks for compatibility issues that can be accepted for continuing.

:return: a list of warnings

initialize()

Initializes the application at setup time.

This method is called from the "initialize" management command. It should set up basic data in the database etc., and needs to be idempotent.

medux.common.api.interfaces.TenantAdminRequiredMixin

View mixin that restricts access to the current tenant's admins.

Access is allowed when the user is a superuser OR has a TenantMembership with role="tenant_admin" for request.tenant.

medux.common.api.interfaces.user_is_tenant_admin(request)

Return True if the request user is an admin of the current tenant.

Accepts three independent signals (OR-combined):

  1. user.is_superuser — unconditional pass.
  2. user.has_perm("common.change_tenant") — the legacy MedUX tenant-admin marker.
  3. A conjunto.tenants.models.TenantMembership row with role="tenant_admin" for request.tenant.

Requires a request.tenant bound by :class:conjunto.middleware.ConjuntoMiddleware only for the third signal; the first two work regardless.