Source code for nkdsu.apps.vote.api_utils
from datetime import datetime
from typing import Protocol, Union, _ProtocolMeta
from django.db.models.base import Model, ModelBase
JsonEncodable = Union[
None,
bool,
int,
float,
str,
datetime,
dict[str, 'JsonEncodable'],
list['JsonEncodable'],
]
JsonDict = dict[str, JsonEncodable]
JsonList = list[JsonEncodable]
[docs]
class SerializableBase(Protocol, metaclass=SerializableModelMeta):
[docs]
def api_dict(self, verbose: bool = False) -> JsonDict: ...
[docs]
class Serializable(SerializableBase, Model):