Skip to content

seeder

django_spire.knowledge.entry.seeding.seeder

EntrySeeder

Bases: DjangoModelSeeder

model_class = models.Entry class-attribute instance-attribute

cache_name = 'entry_seeder' class-attribute instance-attribute

fields = {'id': 'exclude', 'current_version': 'exclude', 'collection_id': ('custom', 'fk_random', {'model_class': Collection}), 'name': ('llm', 'A name for a document. Make it fun and give it a theme')} class-attribute instance-attribute

seed_database classmethod

Source code in django_spire/knowledge/entry/seeding/seeder.py
@classmethod
def seed_database(
        cls,
        count: int = 1,
        fields: dict | None = None
) -> list[models.Entry]:
    entries = super().seed_database(
        count=count,
        fields=fields
    )

    cls._correct_order(entries)
    return cls._set_current_version(entries=entries, count=count)