angee.base.identity
Transport-neutral public-identity adapters for Django models.
SqidPublicIdentity
python
@dataclass(frozen=True, slots=True)
class SqidPublicIdentity()Sqid adapter for a third-party model that Angee cannot add a field to.
public_id_from_pk
python
def public_id_from_pk(value: Any) -> strReturn the public id encoded from a primary-key value.
public_id_to_pk
python
def public_id_to_pk(value: str) -> int | NoneDecode one public id to the backing primary-key value.
public_id_lookup
python
def public_id_lookup(model: type[models.Model], value: str) -> dict[str, Any]Return a Django lookup for value against model.
sqid_field
python
@property
def sqid_field() -> SqidFieldReturn the owner field used to encode and decode this adapter's ids.
public_data_id_field
python
def public_data_id_field(model: type[models.Model]) -> SqidField | NoneReturn the sqid field that makes model safe for public data surfaces.
instance_from_public_id
python
def instance_from_public_id(
model: type[_ModelT],
value: str,
*,
queryset: models.QuerySet[_ModelT] | None = None,
public_identity: SqidPublicIdentity | None = None) -> _ModelT | NoneResolve a generic model or third-party identity; known Angee owners delegate.
public_id_of
python
def public_id_of(instance: models.Model) -> strReturn the public id for a generic model instance.
public_id_for
python
def public_id_for(model: type[models.Model],
pk: Any,
*,
public_identity: SqidPublicIdentity | None = None) -> strReturn a generic model's public id when only its primary key is known.