Skip to content

querysets

django_spire.contrib.sync.file.querysets

FileSyncableQuerySet

Bases: QuerySet

bulk_create

Source code in django_spire/contrib/sync/file/querysets.py
def bulk_create(self, objs: list[Any], **kwargs: Any) -> list[Any]:
    self._compute_hashes(objs)
    return super().bulk_create(objs, **kwargs)

bulk_update

Source code in django_spire/contrib/sync/file/querysets.py
def bulk_update(self, objs: list[Any], fields: list[str] | tuple[str, ...], **kwargs: Any) -> int:
    self._compute_hashes(objs)

    field_set = set(fields)
    field_set.add('sync_field_hash')

    return super().bulk_update(objs, list(field_set), **kwargs)