linkahead.utils.create_revision module#
provides utilities for creating revisions of database entries.
- linkahead.utils.create_revision.bend_references(from_id, to_id, except_for=None)#
redirects all references to a new target.
All entities having a reference pointing to from_id are found and those references are changed to point to to_id. entities having an id listed in except_for are excluded.
- Parameters:
from_id (int) – the old object to which references where pointing
to_id (int) – the new object to which references will be pointing
except_for (list of int) – entities with id of this list will not be changed
- linkahead.utils.create_revision.create_revision(old_id, prop, value)#
Create a revision of an existing record.
This function changes the record with id
old_id. The value of the propertypropis changed tovalue.- Parameters:
old_id (int) – id of the record to be changed
prop (string) – name of the property to be changed
value (type of corresponding property) – the new value of the corresponding property