Open
Description
I want to make an MurmurHash class to create a primary key for a new model instance.
I did this class that adheres to the PrimaryKeyCreator protocol:
# https://github.com/hajimes/mmh3
import mmh3
class Mmh3PrimaryKey:
"""
A client-side generated primary key that follows the MurmurHash (MurmurHash3) spec.
https://en.wikipedia.org/wiki/MurmurHash
"""
@staticmethod
def create_pk(self, *args, **kwargs) -> str:
return str('some argument in args / kwargs')
and set Meta primary_key_creator_cls like this:
class ErrorServer(HashModel):
local_hostname: str
class Meta:
primary_key_creator_cls = Mmh3PrimaryKey
But when I instantiate ErrorServerclass
, no parameter (len of *args, **kwargs == 0) are passed to create_pk
es = ErrorServer(local_hostname='my_hostname', param2='Test')