---
title: "Acuan kelas model"
version: 4.0
locale: id
source: https://docs.djangoproject.com/id/4.0/ref/models/class/
canonical: https://djangodocs.dev/id/4.0/ref/models/class/
---
# Acuan kelas model

This document covers features of the [`Model`](/id/4.0/ref/models/instances/#django.db.models.Model) class.
For more information about models, see [the complete list of Model
reference guides](/id/4.0/ref/models/).

## Atribut

### `DoesNotExist`

#### `exception Model.DoesNotExist`

This exception is raised by the ORM when an expected object is not found.
For example, [`QuerySet.get()`](/id/4.0/ref/models/querysets/#django.db.models.query.QuerySet.get) will raise it when no object is found
for the given lookups.

Django provides a `DoesNotExist` exception as an attribute of each model
class to identify the class of object that could not be found, allowing you
to catch exceptions for a particular model class. The exception is a
subclass of [`django.core.exceptions.ObjectDoesNotExist`](/id/4.0/ref/exceptions/#django.core.exceptions.ObjectDoesNotExist).

### `MultipleObjectsReturned`

#### `exception Model.MultipleObjectsReturned`

This exception is raised by [`QuerySet.get()`](/id/4.0/ref/models/querysets/#django.db.models.query.QuerySet.get) when multiple objects are
found for the given lookups.

Django provides a `MultipleObjectsReturned` exception as an attribute of
each model class to identify the class of object for which multiple objects
were found, allowing you to catch exceptions for a particular model class.
The exception is a subclass of
[`django.core.exceptions.MultipleObjectsReturned`](/id/4.0/ref/exceptions/#django.core.exceptions.MultipleObjectsReturned).

### `objects`

#### `Model.objects`

Each non-abstract [`Model`](/id/4.0/ref/models/instances/#django.db.models.Model) class must have a
[`Manager`](/id/4.0/topics/db/managers/#django.db.models.Manager) instance added to it.
Django ensures that in your model class you have  at least a
default `Manager` specified. If you don't add your own `Manager`,
Django will add an attribute `objects` containing default
[`Manager`](/id/4.0/topics/db/managers/#django.db.models.Manager) instance. If you add your own
[`Manager`](/id/4.0/topics/db/managers/#django.db.models.Manager) instance attribute, the default one does
not appear. Consider the following example:

```
from django.db import models

class Person(models.Model):
    # Add manager with another name
    people = models.Manager()
```

Untuk rincian lebih pada pengelola model lihat [Managers](/id/4.0/topics/db/managers/) and [Retrieving objects](/id/4.0/topics/db/queries/#retrieving-objects).
