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 CRUD names.
Source
server/vueda/core/models.py:806
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 | Default | Description |
|---|---|---|---|---|
| unknown | yes |
load
Return the single instance, or an unsaved default instance if none exists.
Signature
load(cls)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| cls | yes |
Returns
SingletonModel
Source
server/vueda/core/models.py:825
save
Delete all other rows and force id=1 before saving.
Signature
save(self, kwargs)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| self | yes | |||
| kwargs | no |
Source
server/vueda/core/models.py:811
Source
server/vueda/core/models.py:799