DRF Serializers

Account serializers for Smarter API

class smarter.apps.secret.serializers.SecretMiniSerializer(*args, **kwargs)[source]

Bases: MetaDataWithOwnershipModelSerializer

Minimal serializer for the Secret model, exposing only essential fields.

This serializer is intended for use in contexts where only basic secret information is needed, such as listing secrets without sensitive details.

Parameters:
  • id – Integer. Unique identifier for the secret.

  • name – String. Name of the secret.

Note

All fields are read-only in this serializer.

Example usage:

from smarter.apps.account.serializers import SecretMiniSerializer
serializer = SecretMiniSerializer(secret_instance)
data = serializer.data
class smarter.apps.secret.serializers.SecretSerializer(*args, **kwargs)[source]

Bases: MetaDataWithOwnershipModelSerializer

Serializer for the Secret model in the Smarter API.

This serializer exposes all fields of the Secret model, including related user profile information. Use it for endpoints that require secure credential or secret management.

Parameters:
  • id – Integer. Unique identifier for the secret.

  • name – String. Name of the secret.

  • description – String. Description of the secret.

  • last_accessed – DateTime. Timestamp of last access.

  • expires_at – DateTime. Expiration timestamp.

  • user_profile – Instance of UserProfileSerializer. Associated user profile.

Note

All fields are read-only in this serializer.

Example usage:

from smarter.apps.account.serializers import SecretSerializer
serializer = SecretSerializer(secret_instance)
data = serializer.data

See also

For user profile details, see UserProfileSerializer.