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
| Name | Type | Required | Description |
|---|---|---|---|
| unknown | yes |
load
Return the single instance, or an unsaved default instance if none exists.
Signature
load(cls)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| cls | yes |
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
| Name | Type | Required | Description |
|---|---|---|---|
| self | yes | ||
| args | yes | ||
| kwargs | yes |
Source
server/vueda/core/models.py:416
_meta
Source
server/vueda/core/models.py:396