---
url: "https://vueda.dev/v3/reference/api/py/vueda.core.models/SingletonModel.md"
title: "SingletonModel"
---

# 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` {#Meta}

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

### Source {#Meta-source}

`server/vueda/core/models.py:806`

## `formatted_name` {#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-signature}

`formatted_name(unknown)`

#### Parameters {#formatted_name-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="formatted_name-param-unknown">unknown</span> |  | yes |  |  |

## `load` {#load}

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

### Signature {#load-signature}

`load(cls)`

#### Parameters {#load-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| cls |  | yes |  |  |

#### Returns {#load-returns}

`SingletonModel`

### Source {#load-source}

`server/vueda/core/models.py:825`

## `save` {#save}

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

### Signature {#save-signature}

`save(self, kwargs)`

#### Parameters {#save-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| self |  | yes |  |  |
| <span id="save-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#save-source}

`server/vueda/core/models.py:811`

## Source

`server/vueda/core/models.py:799`
