django-eav2/eav/logic/entity_pk.py
Mike b5b576aca5 refactor: apply ruff linter rules and standardize code style
Replace flake8 with ruff and apply consistent linting rules across the entire codebase. Update type annotations, quotation marks, and other style-related changes to comply with the new standards.
2024-09-01 14:57:47 -07:00

12 lines
387 B
Python

from django.db.models.fields import UUIDField
def get_entity_pk_type(entity_cls) -> str:
"""Returns the entity PK type to use.
These values map to `models.Value` as potential fields to use to relate
to the proper entity via the correct PK type.
"""
if isinstance(entity_cls._meta.pk, UUIDField): # noqa: SLF001
return "entity_uuid"
return "entity_id"