Tagairt aicme múnlaLink to this heading

Clúdaíonn an doiciméad seo gnéithe den range:class: ~Django.DB.Models.Model. Le haghaidh tuilleadh faisnéise faoi mhúnlaí, féach:doc: `liosta iomlán na dtreoracha tagartha Múnla' </ref/models/index>.

tréitheLink to this heading

DoeNotacistLink to this heading

exception Model.DoesNotExistLink to this definition

Ardaíonn an ORM an eisceacht seo nuair nach bhfaightear réad a bhfuil súil leis. Mar shampla, ardóidh:: meth: .querySet.get é nuair nach bhfaightear aon rud do na cuardaigh ar leith.

Soláthraíonn Django eisceacht ``doesNotExist ``mar thréith de gach rang samhail chun an aicme réad nach bhféadfaí a aimsiú a aithint, rud a ligeann duit eisceachtaí a ghabháil d'aicme samhail áirithe. Is é an eisceacht fo-aicme de:exc: Django.Core.Exceptions.ObjectDoesNotExist.

``Iolrrudaíreachtaí ar ais ``Link to this heading

exception Model.MultipleObjectsReturnedLink to this definition

Ardaíonn an eisceacht seo ag: meth: .querySet.get nuair a aimsítear rudaí iolracha do na cuardaigh ar leith.

Soláthraíonn Django eisceacht MultipleObjectsReturned mar thréith de gach rang samhail chun an aicme réada ar fuarthas iolracha rudaí a aithint, rud a ligeann duit eisceachtaí a ghabháil d'aicme samhail áirithe. Is é an eisceacht fo-aicme de:exc: Django.Core.Exceptions.MultipleObjectsReturned.

NotUpdatedLink to this heading

exception Model.NotUpdatedLink to this definition

This exception is raised when a forced update of a Model instance does not affect any rows.

Django provides a NotUpdated exception as an attribute of each model class to identify the class of object that could not be updated, allowing you to catch exceptions for a particular model class. The exception is a subclass of django.core.exceptions.ObjectNotUpdated and inherits from django.db.DatabaseError for backward compatibility reasons.

`rudaLink to this heading

Model.objectsLink to this definition

Ní mór do gach rang neamh-teibí: Class: ~Django.db.Models.Models.Model a bheith curtha leis a: class: ~Django.db.Models.Manager leis. Cinntíonn Django go bhfuil “Bainisteoir” réamhshocraithe ar a laghad agat i do rang samhail. Mura gcuireann tú do Bainisteoir ``féin leis, cuirfidh Django tréith ``objects` ina bhfuil sampla réamhshocraithe: ~django.db.models.manager. Má chuireann tú do thréith sampla féin:class: ~Django.db.Models.Manager leis, ní bhíonn an ceann réamhshocraithe le feiceáil. Smaoinigh ar an sampla seo a leanas:

Code
from django.db import models


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

</topics/db/managers> <retrieving-objects>Le haghaidh tuilleadh sonraí faoi bhainisteoirí samhlacha féach:doc: `Bainisteoirí agus:ref: `Rudaí a aisghabháil `.