archivebox.base_models.admin

Base admin classes for models using UUIDv7.

Module Contents

Classes

ConfigOption

KeyValueWidget

A widget that renders JSON dict as editable key-value input fields with + and - buttons to add/remove rows. Includes autocomplete for available config keys from the plugin system.

ConfigEditorMixin

Mixin for admin classes with a config JSON field.

BaseModelAdmin

API

class archivebox.base_models.admin.ConfigOption[source]

Bases: typing.TypedDict

plugin: str[source]

None

type: str | list[str][source]

None

default: object[source]

None

description: str[source]

None

enum: NotRequired[list[object]][source]

None

pattern: NotRequired[str][source]

None

minimum: NotRequired[int | float][source]

None

maximum: NotRequired[int | float][source]

None

class archivebox.base_models.admin.KeyValueWidget[source]

Bases: django.forms.Widget

A widget that renders JSON dict as editable key-value input fields with + and - buttons to add/remove rows. Includes autocomplete for available config keys from the plugin system.

template_name = <Multiline-String>[source]
class Media[source]
css[source]

None

js[source]

[]

_get_config_options() dict[str, archivebox.base_models.admin.ConfigOption][source]

Get available config options from plugins.

_parse_value(value: object) dict[str, object][source]
render(name: str, value: object, attrs: collections.abc.Mapping[str, str] | None = None, renderer: django.forms.renderers.BaseRenderer | None = None) django.utils.safestring.SafeString[source]
_render_row(widget_id: str, key: str, value: str) str[source]
_escape(s: object) str[source]

Escape HTML special chars in attribute values.

value_from_datadict(data: django.http.QueryDict | collections.abc.Mapping[str, object], files: object, name: str) str[source]
class archivebox.base_models.admin.ConfigEditorMixin[source]

Bases: django.contrib.admin.ModelAdmin

Mixin for admin classes with a config JSON field.

Provides a key-value editor widget with autocomplete for available config keys.

formfield_for_dbfield(db_field: django.db.models.Field[object, object], request: django.http.HttpRequest, **kwargs: object) django.forms.Field | None[source]

Use KeyValueWidget for the config JSON field.

class archivebox.base_models.admin.BaseModelAdmin[source]

Bases: django_object_actions.DjangoObjectActions, django.contrib.admin.ModelAdmin

list_display[source]

(‘id’, ‘created_at’, ‘created_by’)

readonly_fields[source]

(‘id’, ‘created_at’, ‘modified_at’)

show_search_mode_selector[source]

False

get_default_search_mode() str[source]
get_form(request: django.http.HttpRequest, obj: django.db.models.Model | None = None, change: bool = False, **kwargs: object)[source]