Skip to content

SingletonModel

Overview

Abstract model that enforces at most one row per subclass. Saving any instance deletes all other rows and forces id=1. Use load() to retrieve or instantiate the single record.

Meta

Default Django Meta base that replaces Django's add/change/view/delete permissions with CRUDL names.

Source

server/vueda/core/models.py:403

formatted_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Signature

formatted_name(unknown)

Parameters

NameTypeRequiredDescription
unknownyes

load

Return the single instance, or an unsaved default instance if none exists.

Signature

load(cls)

Parameters

NameTypeRequiredDescription
clsyes

Returns

<class 'vueda.core.models.SingletonModel'>

Source

server/vueda/core/models.py:422

save

Delete all other rows and force id=1 before saving.

Signature

save(self, args, kwargs)

Parameters

NameTypeRequiredDescription
selfyes
argsyes
kwargsyes

Source

server/vueda/core/models.py:416

_meta

Source

server/vueda/core/models.py:396

Documents matching: server v3.0.0a1.post1client v3.0.0-alpha.2