Skip to content

random_seed

django_spire.contrib.seeding.field.seed.random_seed

RandomEnumFieldSeed

Bases: BaseFieldSeed

Source code in django_spire/contrib/seeding/field/seed/random_seed.py
def __init__(self, enum_: Enum | None = None) -> None:
    self.enum_ = enum_

enum_ = enum_ instance-attribute

generate_value

Source code in django_spire/contrib/seeding/field/seed/random_seed.py
def generate_value(self, seed_index: int) -> Any:
    _ = seed_index

    if self.enum_:
        return random.choice(list(self.enum_))

    return None