Skip to content

seeder

django_spire.knowledge.collection.seeding.seeder

CollectionSeeder

Bases: DjangoModelSeeder

model_class = models.Collection class-attribute instance-attribute

fields = {'id': 'exclude', 'parent': 'exclude', 'name': ('llm', 'A name for a collection of documents. Make it fun and give it a theme'), 'description': ('llm', 'Short description on the what the documents are about, keep it related to the name.')} class-attribute instance-attribute

seed_child_collections classmethod

Source code in django_spire/knowledge/collection/seeding/seeder.py
@classmethod
def seed_child_collections(cls, count: int = 1) -> list[models.Collection]:
    return cls._correct_order(
        cls.seed_database(
            count=count,
            fields=cls.fields | {
                'parent_id': ('custom', 'fk_random', {'model_class': models.Collection})
            },
        )
    )