betty.associations.optional_to_one module#

Optional to-one associations.

final class betty.associations.optional_to_one.OptionalToOne#

Bases: OptionalAttr[OwnerT, AssociateT, ToOneAssociate], ProxyAssociation[OwnerT, AssociateT, AssociateT | None, ToOneAssociate | None, DataDefinition[AssociateT | None, Porter]], Generic

An optional to-one association.

__init__(proxied: ToOne[OwnerT, AssociateT], /)#
associate(owner: OwnerT, associate: AssociateT, /) None#

Associate two entities.

disassociate(owner: OwnerT, associate: AssociateT, /) None#

Disassociate two entities.

async dump_linked_data_for(project: Project, target: OwnerT, /) PortableData#

Dump the given target to JSON-LD.

get_associates(owner: OwnerT, /) Iterable[AssociateT]#

Get the associates for the given owner.

resolve(project: Project, owner: OwnerT, /) None#

Resolve any associates the owner may have for this association.