Skip to content

seeder

django_spire.knowledge.collection.seeding.seeder

CollectionSeeder

Bases: Seeder

Source code in django_spire/contrib/seeding/seeder.py
def __init__(self, count: int = 1, verbose: bool = True) -> None:
    self.seeds: list[Seed] = []
    self._model_object_ids: list[int | str] = []
    self._count: int = count
    self.verbose: bool = verbose

model_class = models.Collection class-attribute instance-attribute

fields_seeds = {'id': Seeder.exclude(), 'parent_id': Seeder.exclude(), 'name': Seeder.llm(str, 'A name for a knowledge base collection, e.g. a department, team, or topic area.'), 'description': Seeder.llm(str, 'Short description of what documents this knowledge base collection holds.')} class-attribute instance-attribute

__post_seed_database__

Source code in django_spire/knowledge/collection/seeding/seeder.py
def __post_seed_database__(self) -> None:
    self._correct_order()

ChildCollectionSeeder

Bases: Seeder

Source code in django_spire/contrib/seeding/seeder.py
def __init__(self, count: int = 1, verbose: bool = True) -> None:
    self.seeds: list[Seed] = []
    self._model_object_ids: list[int | str] = []
    self._count: int = count
    self.verbose: bool = verbose

model_class = models.Collection class-attribute instance-attribute

fields_seeds = {'id': Seeder.exclude(), 'parent_id': Seeder.model.random_queryset_foreign_key(models.Collection.objects.parentless()), 'name': Seeder.llm(str, 'A name for a child knowledge base collection, e.g. a topic within a department.'), 'description': Seeder.llm(str, 'Short description of what documents this child knowledge base collection holds.')} class-attribute instance-attribute

__post_seed_database__

Source code in django_spire/knowledge/collection/seeding/seeder.py
def __post_seed_database__(self) -> None:
    CollectionSeeder._correct_order()

GrandchildCollectionSeeder

Bases: Seeder

Source code in django_spire/contrib/seeding/seeder.py
def __init__(self, count: int = 1, verbose: bool = True) -> None:
    self.seeds: list[Seed] = []
    self._model_object_ids: list[int | str] = []
    self._count: int = count
    self.verbose: bool = verbose

model_class = models.Collection class-attribute instance-attribute

fields_seeds = {'id': Seeder.exclude(), 'parent_id': Seeder.model.random_queryset_foreign_key(models.Collection.objects.filter(parent__isnull=False)), 'name': Seeder.llm(str, 'A name for a nested knowledge base collection, e.g. a sub-topic within a child.'), 'description': Seeder.llm(str, 'Short description of what documents this nested knowledge base collection holds.')} class-attribute instance-attribute

__post_seed_database__

Source code in django_spire/knowledge/collection/seeding/seeder.py
def __post_seed_database__(self) -> None:
    CollectionSeeder._correct_order()