Skip to content

Bulk create history directly (with extra fields) #668

Open
@browze

Description

@browze

Problem Statement
I note that although the history manager class provides the method bulk_history_create (and it's not obviously a 'private' method) it's not "documented" (unless I'm missing something). I've successfully used it but perhaps this could be added to the 'supported' API? My use case is where for example you simply want to freeze a bunch of records 'directly' at a point in time - it would seem that there's no point updating all the 'base' instances with no changes if you have them in memory and you know that they're the latest versions you want to save (besides, it hides the intention of the code).

Also, if I call this bulk_history_create, currently there's no mechanism on the method to provide 'default' values to set across all the records for any extra fields on the history model (that aren't on the instance model). Obviously if the value needs to vary per record, one wouldn't be using bulk create, but if it doesn't, it would be nice to have that option. Is this something you'd be happy to accept a pull request for?

Describe the solution you'd like
Documenting bulk_history_create (adding it to the 'api') and adding a dict kwarg (by default empty) to allow providing 'default' values for extra fields on the history instance when bulk creating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedIssue accepted for completion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions